Browse Source

[cs] Set struct meta to value types added by -net-lib. Closes #3383

Cauê Waneck 11 years ago
parent
commit
66aed49cef
2 changed files with 27 additions and 0 deletions
  1. 3 0
      gencs.ml
  2. 24 0
      tests/unit/issues/Issue3383.hx

+ 3 - 0
gencs.ml

@@ -3452,6 +3452,9 @@ let convert_ilclass ctx p ?(delegate=false) ilcls = match ilcls.csuper with
 		(*	| _ -> raise Exit); *)
 		(match ilcls.csuper with
 			| Some { snorm = LClass ( (["System"],[],"Object"), [] ) } -> ()
+			| Some ({ snorm = LClass ( (["System"],[],"ValueType"), [] ) } as s) ->
+				flags := HExtends (get_type_path ctx (convert_signature ctx p s.snorm)) :: !flags;
+				meta := (Meta.Struct,[],p) :: !meta
 			| Some { snorm = LClass ( (["haxe";"lang"],[],"HxObject"), [] ) } ->
 				meta := (Meta.HxGen,[],p) :: !meta
 			| Some s ->

+ 24 - 0
tests/unit/issues/Issue3383.hx

@@ -0,0 +1,24 @@
+package unit.issues;
+
+class Issue3383 extends Test {
+#if cs
+	function test() {
+		var i:Int = cast null,
+				f:Float = cast null,
+				s:Single = cast null,
+				i64:haxe.Int64 = null,
+				span:cs.system.TimeSpan = null,
+				ui:UInt = cast null,
+				n:cs.system.Nullable_1<Int> = null;
+
+			eq(i, cast null);
+			eq(f, cast null);
+			eq(s, cast null);
+			eq(i64, null);
+			eq(span, null);
+			eq(ui, cast null);
+			eq(n, null);
+	}
+#end
+}
+