Browse Source

[php] fix field acces on TNew inside of a TCast (fixes #6294)

Alexander Kuzmenko 8 years ago
parent
commit
0fe44c040a
2 changed files with 15 additions and 1 deletions
  1. 1 1
      src/generators/genphp.ml
  2. 14 0
      tests/unit/src/unit/issues/Issue6294.hx

+ 1 - 1
src/generators/genphp.ml

@@ -833,7 +833,7 @@ and gen_member_access ctx isvar e s =
 	| _ -> print ctx "->%s" (if isvar then s_ident_field s else s_ident s)
 
 and gen_field_access ctx isvar e s =
-	match e.eexpr with
+	match (reveal_expr e).eexpr with
 	| TTypeExpr t ->
 		let isglobal = match t with
 		| TClassDecl(c) -> Meta.has Meta.PhpGlobal c.cl_meta && c.cl_extern

+ 14 - 0
tests/unit/src/unit/issues/Issue6294.hx

@@ -0,0 +1,14 @@
+package unit.issues;
+
+class Issue6294 extends unit.Test {
+    public function test() {
+        (cast (new Foo():{})).handle();
+        t(true);
+    }
+}
+
+@:keep
+private class Foo {
+    public function new() {}
+    public function handle() {}
+}