Przeglądaj źródła

fixed super.bind (close #2781)

Nicolas Cannasse 11 lat temu
rodzic
commit
d1eac04119
2 zmienionych plików z 18 dodań i 0 usunięć
  1. 16 0
      tests/unit/issues/Issue2750.hx
  2. 2 0
      typer.ml

+ 16 - 0
tests/unit/issues/Issue2750.hx

@@ -9,6 +9,12 @@ private class Parent extends Test {
 	function foo() {
 		return 1;
 	}
+	function bind() {
+		return 1;
+	}
+	function match() {
+		return 1;
+	}
 }
 
 class Issue2750 extends Parent {
@@ -19,6 +25,8 @@ class Issue2750 extends Parent {
     public function new() {
         super();
 		eq(3, foo());
+		eq(3, bind());
+		eq(3, match());
 		call(this);
 		t(unit.TestType.typeError(var x = super));
 		t(unit.TestType.typeError(call(super)));
@@ -29,6 +37,14 @@ class Issue2750 extends Parent {
 	override function foo() {
 		return 2 + super.foo();
 	}
+
+	override function bind() {
+		return 2 + super.bind();
+	}
+
+	override function match() {
+		return 2 + super.match();
+	}
 	
 	function call(c:Parent) { }
 }

+ 2 - 0
typer.ml

@@ -3307,6 +3307,8 @@ and type_call ctx e el (with_type:with_type) p =
 			display_error ctx "callback syntax has changed to func.bind(args)" p;
 			let e = type_expr ctx e Value in
 			type_bind ctx e args p)
+	| (EField ((EConst (Ident "super"),_),_),_), _ ->
+		def()
 	| (EField (e,"bind"),p), args ->
 		let e = type_expr ctx e Value in
 		(match follow e.etype with