Browse Source

[typer] allow static interface variables on externs

closes #7434
Simon Krajewski 7 years ago
parent
commit
4bdba50da8
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/typing/typeloadFields.ml

+ 2 - 1
src/typing/typeloadFields.ml

@@ -1307,7 +1307,8 @@ let init_class ctx c p context_init herits fields =
 			if fctx.is_field_debug then print_endline ("Created field context: " ^ dump_field_context fctx);
 			let cf = init_field (ctx,cctx,fctx) f in
 			if fctx.is_field_debug then print_endline ("Created field: " ^ Printer.s_tclass_field "" cf);
-			if fctx.is_static && c.cl_interface && fctx.field_kind <> FKInit && not cctx.is_lib then error "You can't declare static fields in interfaces" p;
+			if fctx.is_static && c.cl_interface && fctx.field_kind <> FKInit && not cctx.is_lib && not (c.cl_extern) then
+				error "You can't declare static fields in interfaces" p;
 			let set_feature s =
 				ctx.m.curmod.m_extra.m_if_feature <- (s,(c,cf,fctx.is_static)) :: ctx.m.curmod.m_extra.m_if_feature
 			in