Browse Source

[lua] fix issue #5973

Justin Donaldson 8 years ago
parent
commit
bb6dc209d2
2 changed files with 39 additions and 1 deletions
  1. 1 1
      std/lua/Boot.hx
  2. 38 0
      tests/unit/src/unit/issues/Issue5973.hx

+ 1 - 1
std/lua/Boot.hx

@@ -296,7 +296,7 @@ class Boot {
 			var intf = untyped cl1.__interfaces__;
 			for (i in 1...( TableTools.maxn(intf) + 1)){
 				// check each interface, including extended interfaces
-				if (extendsOrImplements(intf[1], cl2)) return true;
+				if (extendsOrImplements(intf[i], cl2)) return true;
 			}
 		}
 		// check standard inheritance

+ 38 - 0
tests/unit/src/unit/issues/Issue5973.hx

@@ -0,0 +1,38 @@
+package unit.issues;
+class Issue5973 extends Test{
+	public function test(){
+		var foo    = new Issue5973Foo();
+		var bar    = new Issue5973Bar();
+		var foobar = new Issue5973FooBar();
+		t(Std.is(foo    , Issue5973IFoo));
+		f(Std.is(foo    , Issue5973IBar));
+		f(Std.is(bar    , Issue5973IFoo));
+		t(Std.is(bar    , Issue5973IBar));
+		t(Std.is(foobar , Issue5973IFoo));
+		t(Std.is(foobar , Issue5973IBar));
+	}
+}
+
+interface Issue5973IFoo {
+	function foo() : Void;
+}
+
+interface Issue5973IBar {
+	function bar() : Void;
+}
+
+class Issue5973Foo implements Issue5973IFoo {
+	public function new() {}
+	public function foo() {}
+}
+
+class Issue5973Bar implements Issue5973IBar {
+	public function new() {}
+	public function bar() {}
+}
+
+class Issue5973FooBar implements Issue5973IFoo implements Issue5973IBar {
+	public function new() {}
+	public function foo() {}
+	public function bar() {}
+}