From 0f7efe21af6424462569d82c4f2b08063ad857c2 Mon Sep 17 00:00:00 2001 From: Andy Li Date: Wed, 1 Jul 2015 13:23:49 +0800 Subject: [PATCH] Allow extern to have field name that is used for both static and instance. --- typeload.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typeload.ml b/typeload.ml index 6bc8f902e1b..216220e2b13 100644 --- a/typeload.ml +++ b/typeload.ml @@ -2707,7 +2707,7 @@ module ClassInitializer = struct () | FKNormal -> let dup = if fctx.is_static then PMap.exists cf.cf_name c.cl_fields || has_field cf.cf_name c.cl_super else PMap.exists cf.cf_name c.cl_statics in - if not cctx.is_native && dup then error ("Same field name can't be use for both static and instance : " ^ cf.cf_name) p; + if not cctx.is_native && not c.cl_extern && dup then error ("Same field name can't be use for both static and instance : " ^ cf.cf_name) p; if List.mem AOverride f.cff_access then c.cl_overrides <- cf :: c.cl_overrides; let is_var f = match cf.cf_kind with | Var _ -> true | _ -> false in if PMap.mem cf.cf_name (if fctx.is_static then c.cl_statics else c.cl_fields) then