Forráskód Böngészése

check recursive implements earlier (closes #4850)

Simon Krajewski 10 éve
szülő
commit
98ae9a3cd6

+ 3 - 0
tests/misc/projects/Issue4850/Main.hx

@@ -0,0 +1,3 @@
+class Main implements Main {
+	public static function main() {}
+}

+ 2 - 0
tests/misc/projects/Issue4850/compile-fail.hxml

@@ -0,0 +1,2 @@
+-main Main
+--interp

+ 1 - 0
tests/misc/projects/Issue4850/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:1: lines 1-3 : Recursive class

+ 1 - 1
typeload.ml

@@ -1394,8 +1394,8 @@ let set_heritance ctx c herits p =
 				if c.cl_array_access <> None then error "Duplicate array access" p;
 				c.cl_array_access <- Some t
 			| TInst (intf,params) ->
-				if not (intf.cl_build()) then cancel_build intf;
 				if is_parent c intf then error "Recursive class" p;
+				if not (intf.cl_build()) then cancel_build intf;
 				if c.cl_interface then error "Interfaces cannot implement another interface (use extends instead)" p;
 				if not intf.cl_interface then error "You can only implement an interface" p;
 				process_meta intf;