diff --git a/Changes b/Changes index b7445c556..baad6dee5 100644 --- a/Changes +++ b/Changes @@ -47,6 +47,7 @@ OCaml 4.01.1: Bug fixes: - PR#6173: Typing error message is worse that before +- PR#6174: OCaml compiler loops on an example using GADTs (non -rectypes) OCaml 4.01.0: ------------- diff --git a/testsuite/tests/typing-gadts/pr6174.ml b/testsuite/tests/typing-gadts/pr6174.ml new file mode 100644 index 000000000..84f79ba0e --- /dev/null +++ b/testsuite/tests/typing-gadts/pr6174.ml @@ -0,0 +1,3 @@ +type _ t = C : ((('a -> 'o) -> 'o) -> ('b -> 'o) -> 'o) t +let f : type a o. ((a -> o) -> o) t -> (a -> o) -> o = + fun C k -> k (fun x -> x);; diff --git a/testsuite/tests/typing-gadts/pr6174.ml.principal.reference b/testsuite/tests/typing-gadts/pr6174.ml.principal.reference new file mode 100644 index 000000000..647015c36 --- /dev/null +++ b/testsuite/tests/typing-gadts/pr6174.ml.principal.reference @@ -0,0 +1,8 @@ + +# Characters 118-119: + fun C k -> k (fun x -> x);; + ^ +Error: Recursive local constraint when unifying + (((ex#0 -> ex#1) -> ex#1) -> (ex#2 -> ex#1) -> ex#1) t + with ((a -> o) -> o) t +# diff --git a/testsuite/tests/typing-gadts/pr6174.ml.reference b/testsuite/tests/typing-gadts/pr6174.ml.reference new file mode 100644 index 000000000..647015c36 --- /dev/null +++ b/testsuite/tests/typing-gadts/pr6174.ml.reference @@ -0,0 +1,8 @@ + +# Characters 118-119: + fun C k -> k (fun x -> x);; + ^ +Error: Recursive local constraint when unifying + (((ex#0 -> ex#1) -> ex#1) -> (ex#2 -> ex#1) -> ex#1) t + with ((a -> o) -> o) t +# diff --git a/typing/ctype.ml b/typing/ctype.ml index aa67a9181..1bf4872ef 100644 --- a/typing/ctype.ml +++ b/typing/ctype.ml @@ -1660,7 +1660,8 @@ let rec local_non_recursive_abbrev visited env p ty = iter_type_expr (local_non_recursive_abbrev visited env p) ty end -let local_non_recursive_abbrev = local_non_recursive_abbrev (ref []) +let local_non_recursive_abbrev env p = + local_non_recursive_abbrev (ref []) env p (*****************************) (* Polymorphic Unification *)