summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlasdair2019-03-08 00:16:47 +0000
committerAlasdair2019-03-08 00:18:59 +0000
commitf0b4a103325e150faa3c2bd0a06594b2e62fae43 (patch)
tree7dc58fcaf5677b1891a0a1c35811ba7cb6867f75 /src
parentdc433c92714e7ea4485a87cfec3b07a3c36910d8 (diff)
Fix: Never consider single variable types to be ambiguous
Diffstat (limited to 'src')
-rw-r--r--src/type_check.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/type_check.ml b/src/type_check.ml
index 603052b5..48a64226 100644
--- a/src/type_check.ml
+++ b/src/type_check.ml
@@ -1851,7 +1851,7 @@ let instantiate_quants quants unifier =
they'll be unambigiously unified with the argument types so it's
better to just not bother with the return type.
*)
-let rec ambiguous_vars (Typ_aux (aux, _)) =
+let rec ambiguous_vars' (Typ_aux (aux, _)) =
match aux with
| Typ_app (_, args) -> List.fold_left KidSet.union KidSet.empty (List.map ambiguous_arg_vars args)
| _ -> KidSet.empty
@@ -1876,6 +1876,10 @@ and ambiguous_nexp_vars (Nexp_aux (aux, _)) =
| Nexp_sum (nexp1, nexp2) -> KidSet.union (tyvars_of_nexp nexp1) (tyvars_of_nexp nexp2)
| _ -> KidSet.empty
+let ambiguous_vars typ =
+ let vars = ambiguous_vars' typ in
+ if KidSet.cardinal vars > 1 then vars else KidSet.empty
+
(**************************************************************************)
(* 3.5. Subtyping with existentials *)
(**************************************************************************)