@@ -9,6 +9,7 @@
all : fixed EnumValue handling in constant propagation with analyzer enabled (#8959)
all : fixed compiler crash upon Void items in array declarations (#8972)
java/cs : fixed `Reflect.callMethod(o, method, args)` for `args` not containing optional arguments (#8975)
+ cs : fixed Json.stringify for @:struct-annotated classes (#8979)
python : fixed invalid generation of some inlined code blocks (#8971)
@@ -269,7 +269,7 @@ enum ValueType {
if (Std.is(v, HxEnum))
return ValueType.TEnum(cast t.BaseType); // enum constructors are subclasses of an enum type
if (t.IsValueType) {
- var vc:cs.system.IConvertible = cast v;
+ var vc = Std.downcast(v, cs.system.IConvertible);
if (vc != null) {
switch (vc.GetTypeCode()) {
case cs.system.TypeCode.Boolean:
@@ -0,0 +1,24 @@
+package unit.issues;
+
+import haxe.Json;
+class Issue8979 extends unit.Test {
+#if cs
+ function test() {
+ var d = new DummyStruct();
+ d.hello = 'world';
+ var json = Json.stringify(d);
+ eq('{"hello":"world"}', json);
+ eq('world', Json.parse(json).hello);
+ }
+#end
+}
+@:struct
+private class DummyStruct {
+ public var hello:String;
+ public function new() {}