From f0b4a103325e150faa3c2bd0a06594b2e62fae43 Mon Sep 17 00:00:00 2001 From: Alasdair Date: Fri, 8 Mar 2019 00:16:47 +0000 Subject: Fix: Never consider single variable types to be ambiguous --- src/type_check.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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 *) (**************************************************************************) -- cgit v1.2.3