File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -3969,8 +3969,8 @@ let rec subtype_rec env trace t1 t2 cstrs =
3969
3969
let label_decl_sub (acc1 , acc2 ) ld2 =
3970
3970
match Ext_list. find_first fields1 (fun ld1 -> ld1.ld_id.name = ld2.ld_id.name) with
3971
3971
| Some ld1 ->
3972
- if field_is_optional ld1.ld_id repr1 && not (field_is_optional ld2.ld_id repr2) then
3973
- (* optional field can't be cast to non-optional one *)
3972
+ if field_is_optional ld1.ld_id repr1 <> (field_is_optional ld2.ld_id repr2) then
3973
+ (* optional field can't be modified *)
3974
3974
violation := true ;
3975
3975
let get_as (({txt} , payload ) : Parsetree. attribute ) =
3976
3976
if txt = " as" then Ast_payload. is_single_string payload
Original file line number Diff line number Diff line change @@ -6,14 +6,14 @@ type r3 = {a?: int}
6
6
7
7
type r4 = {}
8
8
9
- let _ = (x : r1 ) => (x :> r2 ) // Convert a from mandatory to optional
9
+ // let _ = (x: r1) => (x :> r2) // Convert a from mandatory to optional NOT ALLOWED
10
10
// let _ = (x: r2) => (x :> r1) can't turn an optional field to a mandatory one
11
11
let _ = (x : r2 ) => (x :> r3 ) // can omit field
12
- let _ = (x : r1 ) => (x :> r3 ) // omit field and convert from mandatory to optional
12
+ // let _ = (x: r1) => (x :> r3) // omit field and convert from mandatory to optional NOT ALLOWED
13
13
let _ = (x : r3 ) => (x :> r4 ) // omit everything
14
14
15
- type nested1 = {n : r1 , extra : int }
16
- type nested2 = {n : r2 }
15
+ type nested1 = {n : r2 , extra : int }
16
+ type nested2 = {n : r3 }
17
17
let _ = (x : nested1 ) => (x :> nested2 )
18
18
19
19
module TestInlining = {
You can’t perform that action at this time.
0 commit comments