subtype_row: filter out absent fields when the other row is closed
parent
f53ba75b32
commit
94730c3af1
|
@ -56,13 +56,6 @@ let f x =
|
|||
;;
|
||||
[%%expect{|
|
||||
type _ t = T : 'a -> 'a t
|
||||
Line _, characters 11-37:
|
||||
| T _ -> (x :> [`A | `C] Element.t)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Error: Type [ `A ] Element.t is not a subtype of [ `A | `C ] Element.t
|
||||
The first variant type does not allow tag(s) `C
|
||||
|}, Principal{|
|
||||
type _ t = T : 'a -> 'a t
|
||||
val f : [ `A ] Element.t -> [ `A | `C ] Element.t = <fun>
|
||||
|}];;
|
||||
|
||||
|
@ -72,11 +65,7 @@ let f () =
|
|||
(x :> [ `A | `C ] Element.t)
|
||||
;;
|
||||
[%%expect{|
|
||||
Line _, characters 2-30:
|
||||
(x :> [ `A | `C ] Element.t)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Error: Type [ `A ] Element.t is not a subtype of [ `A | `C ] Element.t
|
||||
The first variant type does not allow tag(s) `C
|
||||
val f : unit -> [ `A | `C ] Element.t = <fun>
|
||||
|}];;
|
||||
|
||||
let f () =
|
||||
|
|
|
@ -4121,6 +4121,8 @@ and subtype_row env trace row1 row2 cstrs =
|
|||
let row1 = row_repr row1 and row2 = row_repr row2 in
|
||||
let r1, r2, pairs =
|
||||
merge_row_fields row1.row_fields row2.row_fields in
|
||||
let r1 = if row2.row_closed then filter_row_fields false r1 else r1 in
|
||||
let r2 = if row1.row_closed then filter_row_fields false r2 else r2 in
|
||||
let more1 = repr row1.row_more
|
||||
and more2 = repr row2.row_more in
|
||||
match more1.desc, more2.desc with
|
||||
|
|
Loading…
Reference in New Issue