浏览代码

run check_interface on interfaces which extend other interfaces too (closes #2969)

Simon Krajewski 11 年之前
父节点
当前提交
c96fa3058a
共有 3 个文件被更改,包括 23 次插入1 次删除
  1. 17 0
      tests/misc/projects/Issue2969/Main.hx
  2. 1 0
      tests/misc/projects/Issue2969/compile-fail.hxml
  3. 5 1
      typeload.ml

+ 17 - 0
tests/misc/projects/Issue2969/Main.hx

@@ -0,0 +1,17 @@
+interface A {
+	public function a():String;
+}
+
+interface B extends A {
+
+}
+
+interface C extends B {
+	public function a():Int;
+}
+
+class Main {
+	static function main() {
+
+	}
+}

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

@@ -0,0 +1 @@
+--run Main

+ 5 - 1
typeload.ml

@@ -1080,7 +1080,11 @@ let set_heritance ctx c herits p =
 			process_meta csup;
 			if c.cl_interface then begin
 				if not csup.cl_interface then error "Cannot extend by using a class" p;
-				c.cl_implements <- (csup,params) :: c.cl_implements
+				c.cl_implements <- (csup,params) :: c.cl_implements;
+				if not !has_interf then begin
+					delay ctx PForce (fun() -> check_interfaces ctx c);
+					has_interf := true;
+				end
 			end else begin
 				if csup.cl_interface then error "Cannot extend by using an interface" p;
 				c.cl_super <- Some (csup,params)