Infer scalar types with let generalization
This commit is contained in:
15 files changed
+980
-13
No files matched your search
@@ -63,3 +63,32 @@ let run_suite suite cases =
|
||||
let failure_count () = !failures
|
||||
|
||||
let case_count () = !cases
|
||||
|
||||
let root () = try Sys.getenv "DELTA_ROOT" with Not_found -> "."
|
||||
|
||||
let fixture name = Filename.concat (root ()) (Filename.concat "test/fixture" name)
|
||||
|
||||
let read_fixture name = Native.read_file (fixture name)
|
||||
|
||||
let error_of thunk =
|
||||
try
|
||||
ignore (thunk ());
|
||||
None
|
||||
with Diagnostic.Error diagnostic -> Some diagnostic
|
||||
|
||||
let parse text = Parse.program text
|
||||
|
||||
let resolve text = Resolve.program (parse text)
|
||||
|
||||
let infer text = Infer.program (resolve text)
|
||||
|
||||
let parse_error text = error_of (fun () -> parse text)
|
||||
|
||||
let resolve_error text = error_of (fun () -> resolve text)
|
||||
|
||||
let infer_error text = error_of (fun () -> infer text)
|
||||
|
||||
let check_message name expected thunk =
|
||||
match error_of thunk with
|
||||
| None -> fail name "expected a diagnostic"
|
||||
| Some diagnostic -> check_equal_string name expected diagnostic.Diagnostic.message
|
||||
Reference in new issue
Block a user