summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Campbell2018-04-20 14:13:30 +0100
committerBrian Campbell2018-04-20 14:13:30 +0100
commit895f868cd537277ba61dfc427fee0e288af7e226 (patch)
treef7f406b4ec55daf0f8f9339576dba6a404a260c6
parent83b7f7065c638ed3b0e0c40a5c4b64257bae4975 (diff)
Allow instantiation of type or order type variables without kind declaration
-rw-r--r--src/type_check.ml2
-rw-r--r--test/typecheck/pass/anontyvar.sail15
2 files changed, 17 insertions, 0 deletions
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 <smt.sail>
+$include <flow.sail>
+
+/* 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);
+ ()
+}