Ver Fonte

[dce] don't forget to check FClosure (fixes #8200)

Alexander Kuzmenko há 6 anos atrás
pai
commit
4ce4f91767
2 ficheiros alterados com 24 adições e 3 exclusões
  1. 4 3
      src/optimization/dce.ml
  2. 20 0
      tests/unit/src/unit/issues/Issue8200.hx

+ 4 - 3
src/optimization/dce.ml

@@ -425,11 +425,12 @@ and expr_field dce e fa is_call_expr =
 				check_and_add_feature dce "dynamic_read";
 				check_and_add_feature dce ("dynamic_read." ^ n);
 			| _ -> ());
-			begin match follow e.etype with
-				| TInst(c,_) ->
+			begin match follow e.etype, fa with
+				| TInst(c,_), _
+				| _, FClosure (Some (c, _), _) ->
 					mark_class dce c;
 					field dce c n false;
-				| TAnon a ->
+				| TAnon a, _ ->
 					(match !(a.a_status) with
 					| Statics c ->
 						mark_class dce c;

+ 20 - 0
tests/unit/src/unit/issues/Issue8200.hx

@@ -0,0 +1,20 @@
+package unit.issues;
+
+class Issue8200 extends unit.Test {
+	function test() {
+		var a:Abstract = new Impl();
+		t(a.foo.bind()());
+	}
+}
+
+class Impl implements Interface {
+	public function new() {}
+	public function foo():Bool return true;
+}
+
+@:forward
+abstract Abstract(Interface) from Interface to Interface {}
+
+interface Interface {
+	function foo():Bool;
+}