Browse Source

fixed implements + inline

Nicolas Cannasse 14 years ago
parent
commit
35bd35c2f7
1 changed files with 6 additions and 1 deletions
  1. 6 1
      typeload.ml

+ 6 - 1
typeload.ml

@@ -384,9 +384,14 @@ let rec check_interface ctx c p intf params =
 			let t2, f2 = class_field_no_interf c i in
 			let t2, f2 = class_field_no_interf c i in
 			ignore(follow f2.cf_type); (* force evaluation *)
 			ignore(follow f2.cf_type); (* force evaluation *)
 			let p = (match f2.cf_expr with None -> p | Some e -> e.epos) in
 			let p = (match f2.cf_expr with None -> p | Some e -> e.epos) in
+			let mkind = function
+				| MethNormal | MethInline -> 0
+				| MethDynamic -> 1
+				| MethMacro -> 2
+			in
 			if f.cf_public && not f2.cf_public then
 			if f.cf_public && not f2.cf_public then
 				display_error ctx ("Field " ^ i ^ " should be public as requested by " ^ s_type_path intf.cl_path) p
 				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 -> m1 = m2 | _ -> false) then
+			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
 				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
 			else try
 				valid_redefinition ctx f2 t2 f (apply_params intf.cl_types params f.cf_type)
 				valid_redefinition ctx f2 t2 f (apply_params intf.cl_types params f.cf_type)