Browse Source

[swf] do not use followed type to classify type parameter field access type (closes #3588) (closes #3681)

Simon Krajewski 10 years ago
parent
commit
115391998a
3 changed files with 17 additions and 3 deletions
  1. 1 1
      genswf9.ml
  2. 16 0
      tests/unit/src/unit/issues/Issue3588.hx
  3. 0 2
      tests/unit/src/unit/issues/Issue3681.hx

+ 1 - 1
genswf9.ml

@@ -907,7 +907,7 @@ let rec gen_access ctx e (forset : 'a) : 'a access =
 			in
 			(* if the return type is one of the type-parameters, then we need to cast it *)
 			if is_type_parameter_field then
-				VCast (id, classify ctx et)
+				VCast (id, classify ctx e.etype)
 			else if Codegen.is_volatile e.etype then
 				VVolatile (id,None)
 			else

+ 16 - 0
tests/unit/src/unit/issues/Issue3588.hx

@@ -0,0 +1,16 @@
+package unit.issues;
+
+private class Foo<T> {
+    public var fooField:T;
+
+    public function new(fooField:T) {
+        this.fooField = fooField;
+    }
+}
+
+class Issue3588 extends Test {
+	function test() {
+        var foo = new Foo<Null<Float>>(null);
+        eq(null, foo.fooField);
+	}
+}

+ 0 - 2
tests/unit/src/unit/issues/Issue3681.hx

@@ -12,7 +12,6 @@ private class Node<T>
 }
 
 class Issue3681 extends Test {
-    #if !flash
 	function test() {
         var i:Null<Int> = null;
         var nodes = new Node(i,new Node(1,new Node(2, new Node(i))));
@@ -25,5 +24,4 @@ class Issue3681 extends Test {
         }
         t(matches);
 	}
-    #end
 }