From 5bc5f5dee8921f8d24260dae54177e00c291fcb1 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Mon, 10 Dec 2018 20:39:16 +0000 Subject: Various changes: * Improve type inference for numeric if statements (if_infer test) * Correctly handle constraints for existentially quantified constructors (constraint_ctor test) * Canonicalise all numeric types in function arguments, which triggers some weird edge cases between parametric polymorphism and subtyping of numeric arguments * Because of this eq_int, eq_range, and eq_atom etc become identical * Avoid duplicating destruct_exist in Env * Handle some odd subtyping cases better --- src/initial_check.ml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/initial_check.ml') diff --git a/src/initial_check.ml b/src/initial_check.ml index 0f1af63d..44f36892 100644 --- a/src/initial_check.ml +++ b/src/initial_check.ml @@ -777,6 +777,11 @@ let typschm_of_string str = let typschm, _ = to_ast_typschm initial_ctx typschm in typschm +let typ_of_string str = + let typ = Parser.typ_eof Lexer.token (Lexing.from_string str) in + let typ = to_ast_typ initial_ctx typ in + typ + let extern_of_string id str = mk_val_spec (VS_val_spec (typschm_of_string str, id, (fun _ -> Some (string_of_id id)), false)) let val_spec_of_string id str = mk_val_spec (VS_val_spec (typschm_of_string str, id, (fun _ -> None), false)) -- cgit v1.2.3