Skip to content

Commit

Permalink
Fix PR#7397
Browse files Browse the repository at this point in the history
  • Loading branch information
garrigue committed Nov 3, 2016
1 parent ef46839 commit 02d7c27
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
25 changes: 25 additions & 0 deletions testsuite/tests/typing-gadts/pr7397.ml
@@ -0,0 +1,25 @@
type +'a t

class type a = object
method b : b
end

and b = object
method a : a
end

type _ response =
| C : #a t response;;
[%%expect{|
type +'a t
class type a = object method b : b end
and b = object method a : a end
type _ response = C : #a t response
|}]

let f (type a) (a : a response) =
match a with
| C -> 0;;
[%%expect{|
val f : 'a response -> int = <fun>
|}]
5 changes: 4 additions & 1 deletion typing/ctype.ml
Expand Up @@ -1657,7 +1657,10 @@ let rec local_non_recursive_abbrev strict visited env p ty =
end

let local_non_recursive_abbrev env p ty =
try local_non_recursive_abbrev false [] env p ty; true
try (* PR#7397: need to check trace_gadt_instances *)
wrap_trace_gadt_instances env
(local_non_recursive_abbrev false [] env p) ty;
true
with Occur -> false


Expand Down

0 comments on commit 02d7c27

Please sign in to comment.