You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indeed, the fact that a structural type may be compatible with an aliasable type was not taken into account in the compatibility check, and as a result the pattern-matching was wrongly deemed exhaustive.
This is fixed in 4.00 and trunk, at revisions 13009 and 13008.
Original bug ID: 5785
Reporter: @yallop
Assigned to: @garrigue
Status: closed (set by @garrigue on 2012-10-12T01:44:21Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.00.1
Fixed in version: 4.00.2+dev
Category: typing
Child of: #5998
Monitored by: @diml @alainfrisch
Bug description
$ cat test.ml
module Add (T : sig type two end) =
struct
type _ t =
| One : [`One] t
| Two : T.two t
let add (type a) : a t * a t -> string = function
| One, One -> "two"
| Two, Two -> "four"
end
module M = Add(struct type two = [`One] end)
let _ =
begin
print_endline (M.add (M.One, M.Two));
print_endline (M.add (M.Two, M.One));
end
$ ocamlc -w A test.ml -o test
$ ./test
two
four
File attachments
The text was updated successfully, but these errors were encountered: