this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Mark cell as failed if it doesnt typecheck

+27 -35
+6 -2
lib/impl.ml
··· 107 107 val init_function : string -> unit -> unit 108 108 val get_stdlib_dcs : string -> Toplevel_api_gen.dynamic_cmis list 109 109 val findlib_init : string -> findlib_t 110 + val path : string 110 111 111 112 val require : 112 113 bool -> findlib_t -> string list -> Toplevel_api_gen.dynamic_cmis list ··· 355 356 let init (init_libs : Toplevel_api_gen.init_config) = 356 357 try 357 358 Logs.info (fun m -> m "init()"); 358 - path := Some "/static/cmis"; 359 + path := Some S.path; 359 360 360 361 findlib_v := Some (S.findlib_init "findlib_index"); 361 362 let stdlib_dcs = ··· 895 896 source; 896 897 }) 897 898 in 898 - if List.length errors = 0 then add_cmi id deps src; 899 + (if List.length errors = 0 900 + then add_cmi id deps src 901 + else failed_cells := StringSet.add id !failed_cells); 902 + 899 903 (* Logs.info (fun m -> m "Got to end"); *) 900 904 IdlM.ErrM.return errors 901 905 with e ->
+21 -33
test/unix/unix_test.ml
··· 85 85 with exn -> 86 86 handle_findlib_error exn; 87 87 [] 88 + 89 + let path = "/tmp/cmis" 88 90 end 89 91 90 92 module U = Impl.Make (S) 91 93 92 - (* let test () = 93 - let _x = Compmisc.initial_env in 94 - let oc = open_out "/tmp/unix_worker.ml" in 95 - Printf.fprintf oc "let x=1;;\n"; 96 - close_out oc; 97 - let unit_info = Unit_info.make ~source_file:"/tmp/unix_worker.ml" "/tmp/unix_worker" in 98 - try 99 - let _ast = Pparse.parse_implementation ~tool_name:"worker" "/tmp/unix_worker.ml" in 100 - let _ = Typemod.type_implementation unit_info (Compmisc.initial_env ()) _ast in 101 - () 102 - with exn -> 103 - Printf.eprintf "error: %s\n%!" (Printexc.to_string exn); 104 - let ppf = Format.err_formatter in 105 - let _ = Location.report_exception ppf exn in 106 - () *) 107 - 108 94 let start_server () = 95 + (try Unix.mkdir S.path 0o777 with Unix.Unix_error (Unix.EEXIST, _, _) -> ()); 109 96 let open U in 110 97 Logs.set_reporter (Logs_fmt.reporter ()); 111 98 Logs.set_level (Some Logs.Info); ··· 122 109 IdlM.server Server.implementation 123 110 124 111 module Client = Js_top_worker_rpc.Toplevel_api_gen.Make (Impl.IdlM.GenClient ()) 112 + 113 + let c1, c2, c3, c4 = "c1", "c2", "c3", "c4" 114 + let notebook = [ 115 + (c1,[],"typ xxxx = int;;\n"); 116 + (c2,[c1],"type yyy=xxx;;\n"); 117 + (c3,[c1;c2],"type xxx = int;;\n"); 118 + (c4,[c1;c2;c3],"type yyy = xxx;;\n"); 119 + ] 125 120 126 121 let _ = 127 122 let rpc = start_server () in ··· 132 127 { stdlib_dcs = None; findlib_requires = []; execute = true } 133 128 in 134 129 let x = 130 + let rec run notebook = 131 + match notebook with 132 + | (id, deps, cell) :: cells -> 133 + let* errs = Client.query_errors rpc (Some id) deps false cell in 134 + Printf.printf "Cell %s: %d errors\n%!" id (List.length errs); 135 + run cells 136 + | [] -> IdlM.ErrM.return () 137 + in 135 138 let* _ = Client.init rpc init in 136 - let* o = Client.setup rpc () in 137 - Printf.printf "setup output: %s\n%!" (Option.value ~default:"" o.stdout); 138 - let* _ = 139 - Client.query_errors rpc (Some "c1") [] false "typ xxxx = int;;\n" 140 - in 141 - let* o1 = 142 - Client.query_errors rpc (Some "c2") [ "c1" ] false "type yyy = xxx;;\n" 143 - in 144 - Printf.printf "Number of errors: %d\n%!" (List.length o1); 145 - let* _ = 146 - Client.query_errors rpc (Some "c1") [] false "type xxx = int;;\n" 147 - in 148 - let* o2 = 149 - Client.query_errors rpc (Some "c2") [ "c1" ] false "type yyy = xxx;;\n" 150 - in 151 - Printf.printf "Number of errors1: %d\n%!" (List.length o1); 152 - Printf.printf "Number of errors2: %d\n%!" (List.length o2); 139 + let* _ = Client.setup rpc () in 140 + let* _ = run notebook in 153 141 IdlM.ErrM.return () 154 142 in 155 143 match x |> IdlM.T.get |> M.run with