|
@@ -1905,7 +1905,6 @@ let rec type_eq param a b =
|
|
|
try
|
|
|
let f2 = PMap.find n a2.a_fields in
|
|
|
if f1.cf_kind <> f2.cf_kind && (param = EqStrict || param = EqCoreType || not (unify_kind f1.cf_kind f2.cf_kind)) then error [invalid_kind n f1.cf_kind f2.cf_kind];
|
|
|
- if has_class_field_flag f1 CfFinal <> has_class_field_flag f2 CfFinal then raise (Unify_error [FinalInvariance]);
|
|
|
let a = f1.cf_type and b = f2.cf_type in
|
|
|
(try type_eq param a b with Unify_error l -> error (invalid_field n :: l));
|
|
|
if (has_class_field_flag f1 CfPublic) != (has_class_field_flag f2 CfPublic) then error [invalid_visibility n];
|
|
@@ -2246,7 +2245,7 @@ and unify_anons a b a1 a2 =
|
|
|
let f1 = PMap.find n a1.a_fields in
|
|
|
if not (unify_kind f1.cf_kind f2.cf_kind) then
|
|
|
(match !(a1.a_status), f1.cf_kind, f2.cf_kind with
|
|
|
- | Opened, Var { v_read = AccNormal; v_write = AccNever }, Var { v_read = AccNormal; v_write = AccNormal } ->
|
|
|
+ | Opened, Var { v_read = AccNormal; v_write = AccNo }, Var { v_read = AccNormal; v_write = AccNormal } ->
|
|
|
f1.cf_kind <- f2.cf_kind;
|
|
|
| _ -> error [invalid_kind n f1.cf_kind f2.cf_kind]);
|
|
|
if (has_class_field_flag f2 CfPublic) && not (has_class_field_flag f1 CfPublic) then error [invalid_visibility n];
|
|
@@ -2398,15 +2397,7 @@ and unify_with_access f1 t1 f2 =
|
|
|
| Var { v_read = AccNo } | Var { v_read = AccNever } -> unify f2.cf_type t1
|
|
|
(* read only *)
|
|
|
| Method MethNormal | Method MethInline | Var { v_write = AccNo } | Var { v_write = AccNever } ->
|
|
|
- begin match (has_class_field_flag f1 CfFinal),(has_class_field_flag f2 CfFinal) with
|
|
|
- | true,true
|
|
|
- | false,false ->
|
|
|
- ()
|
|
|
- | true,false ->
|
|
|
- ()
|
|
|
- | false,true ->
|
|
|
- raise (Unify_error [FinalInvariance]);
|
|
|
- end;
|
|
|
+ if (has_class_field_flag f1 CfFinal) <> (has_class_field_flag f2 CfFinal) then raise (Unify_error [FinalInvariance]);
|
|
|
unify t1 f2.cf_type
|
|
|
(* read/write *)
|
|
|
| _ -> with_variance (type_eq EqBothDynamic) t1 f2.cf_type
|