|
@@ -353,26 +353,28 @@ module Inheritance = struct
|
|
else
|
|
else
|
|
t2, f2
|
|
t2, f2
|
|
in
|
|
in
|
|
- ignore(follow f2.cf_type); (* force evaluation *)
|
|
|
|
- let p = f2.cf_name_pos in
|
|
|
|
- let mkind = function
|
|
|
|
- | MethNormal | MethInline -> 0
|
|
|
|
- | MethDynamic -> 1
|
|
|
|
- | MethMacro -> 2
|
|
|
|
- in
|
|
|
|
- if (has_class_field_flag f CfPublic) && not (has_class_field_flag f2 CfPublic) && not (Meta.has Meta.CompilerGenerated f.cf_meta) then
|
|
|
|
- display_error ctx ("Field " ^ i ^ " should be public as requested by " ^ s_type_path intf.cl_path) p
|
|
|
|
- else if not (unify_kind f2.cf_kind f.cf_kind) || not (match f.cf_kind, f2.cf_kind with Var _ , Var _ -> true | Method m1, Method m2 -> mkind m1 = mkind m2 | _ -> false) then
|
|
|
|
- display_error ctx ("Field " ^ i ^ " has different property access than in " ^ s_type_path intf.cl_path ^ " (" ^ s_kind f2.cf_kind ^ " should be " ^ s_kind f.cf_kind ^ ")") p
|
|
|
|
- else try
|
|
|
|
- valid_redefinition ctx f2 t2 f (apply_params intf.cl_params params f.cf_type)
|
|
|
|
- with
|
|
|
|
- Unify_error l ->
|
|
|
|
- if not (Meta.has Meta.CsNative c.cl_meta && (has_class_flag c CExtern)) then begin
|
|
|
|
- display_error ctx ("Field " ^ i ^ " has different type than in " ^ s_type_path intf.cl_path) p;
|
|
|
|
- display_error ctx (compl_msg "Interface field is defined here") f.cf_pos;
|
|
|
|
- display_error ctx (compl_msg (error_msg (Unify l))) p;
|
|
|
|
- end
|
|
|
|
|
|
+ delay ctx PForce (fun () ->
|
|
|
|
+ ignore(follow f2.cf_type); (* force evaluation *)
|
|
|
|
+ let p = f2.cf_name_pos in
|
|
|
|
+ let mkind = function
|
|
|
|
+ | MethNormal | MethInline -> 0
|
|
|
|
+ | MethDynamic -> 1
|
|
|
|
+ | MethMacro -> 2
|
|
|
|
+ in
|
|
|
|
+ if (has_class_field_flag f CfPublic) && not (has_class_field_flag f2 CfPublic) && not (Meta.has Meta.CompilerGenerated f.cf_meta) then
|
|
|
|
+ display_error ctx ("Field " ^ i ^ " should be public as requested by " ^ s_type_path intf.cl_path) p
|
|
|
|
+ else if not (unify_kind f2.cf_kind f.cf_kind) || not (match f.cf_kind, f2.cf_kind with Var _ , Var _ -> true | Method m1, Method m2 -> mkind m1 = mkind m2 | _ -> false) then
|
|
|
|
+ display_error ctx ("Field " ^ i ^ " has different property access than in " ^ s_type_path intf.cl_path ^ " (" ^ s_kind f2.cf_kind ^ " should be " ^ s_kind f.cf_kind ^ ")") p
|
|
|
|
+ else try
|
|
|
|
+ valid_redefinition ctx f2 t2 f (apply_params intf.cl_params params f.cf_type)
|
|
|
|
+ with
|
|
|
|
+ Unify_error l ->
|
|
|
|
+ if not (Meta.has Meta.CsNative c.cl_meta && (has_class_flag c CExtern)) then begin
|
|
|
|
+ display_error ctx ("Field " ^ i ^ " has different type than in " ^ s_type_path intf.cl_path) p;
|
|
|
|
+ display_error ctx (compl_msg "Interface field is defined here") f.cf_pos;
|
|
|
|
+ display_error ctx (compl_msg (error_msg (Unify l))) p;
|
|
|
|
+ end
|
|
|
|
+ )
|
|
with
|
|
with
|
|
| Not_found when (has_class_flag c CAbstract) ->
|
|
| Not_found when (has_class_flag c CAbstract) ->
|
|
let cf = {f with cf_overloads = []} in
|
|
let cf = {f with cf_overloads = []} in
|