From 895f868cd537277ba61dfc427fee0e288af7e226 Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Fri, 20 Apr 2018 14:13:30 +0100 Subject: Allow instantiation of type or order type variables without kind declaration --- src/type_check.ml | 2 ++ test/typecheck/pass/anontyvar.sail | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/typecheck/pass/anontyvar.sail diff --git a/src/type_check.ml b/src/type_check.ml index 9de6d7e7..cad7dc47 100644 --- a/src/type_check.ml +++ b/src/type_check.ml @@ -1861,10 +1861,12 @@ let is_nat_kid kid = function let is_order_kid kid = function | KOpt_aux (KOpt_kind (K_aux (K_kind [BK_aux (BK_order, _)], _), kid'), _) -> Kid.compare kid kid' = 0 + | KOpt_aux (KOpt_none kid', _) -> Kid.compare kid kid' = 0 | _ -> false let is_typ_kid kid = function | KOpt_aux (KOpt_kind (K_aux (K_kind [BK_aux (BK_type, _)], _), kid'), _) -> Kid.compare kid kid' = 0 + | KOpt_aux (KOpt_none kid', _) -> Kid.compare kid kid' = 0 | _ -> false let rec instantiate_quants quants kid uvar = match quants with diff --git a/test/typecheck/pass/anontyvar.sail b/test/typecheck/pass/anontyvar.sail new file mode 100644 index 00000000..99c25e6c --- /dev/null +++ b/test/typecheck/pass/anontyvar.sail @@ -0,0 +1,15 @@ +$include +$include + +/* We shouldn't have to annotate 'a with Type */ +val id : forall 'a. 'a -> 'a +function id(x) = { + x +} + +val test : unit -> unit + +function test() = { + let x = id(5); + () +} -- cgit v1.2.3