فهرست منبع

don't allow a structure to be like a class/enum

Nicolas Cannasse 15 سال پیش
والد
کامیت
7abd4d1b98
2فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 2 0
      Makefile.win
  2. 4 1
      type.ml

+ 2 - 0
Makefile.win

@@ -61,6 +61,8 @@ typeload.cmx: typecore.cmx type.cmx parser.cmx common.cmx ast.cmx
 
 typer.cmx: typeload.cmx typecore.cmx type.cmx parser.cmx lexer.cmx common.cmx ast.cmx codegen.cmx optimizer.cmx
 
+optimizer.cmx: type.cmx
+
 
 clean:
 	rm -f haxe.exe

+ 4 - 1
type.ml

@@ -733,7 +733,10 @@ let rec unify a b =
 			| Opened ->
 				a1.a_status := Closed
 			| _ -> ());
-			if !(a2.a_status) = Opened then a2.a_status := Closed;
+			(match !(a2.a_status) with
+			| Statics _ | EnumStatics _ -> error []
+			| Opened -> a2.a_status := Closed
+			| _ -> ())
 		with
 			Unify_error l -> error (cannot_unify a b :: l))
 	| TAnon an, TInst ({ cl_path = [],"Class" },[pt]) ->