Map with inserted Map and instance field initiation

Hello, I have an issue with instance field initiation:

private var _field:Map<String, Map<String, Dynamic>> = [ "'key'" => new Map<String, Dynamic>() ];

and get this errors:

key : String → value : Map<String, Dynamic> → Void should be String → haxe.ds.StringMap<Unknown<0>> → Void
Cannot unify argument 2
haxe.ds.StringMap<Unknown<0>> should be Map<String, Dynamic>
haxe.ds.StringMap<Unknown<0>> should be haxe.ds.Map<String, Dynamic>

Almost same:

var _field:Map<String, Map<String, Dynamic>> = [ "'key'" => new Map<String, Dynamic>() ];

inside any function works fine. I assume its cuz “var _field:Map<String, Map<String, Dynamic>> = [ “‘key’” => new Map<String, Dynamic>() ];” during compilation converts into:

var _field:Map<String, Map<String, Dynamic>>;
var tempMap:Map<String, Dynamic> = new Map<String, Dynamic>();
tempMap["'key'"] = new Map<String, Dynamic>();
_field = tempMap;

So it cant be used for instance field initiation. Let me know if I’m right and that cant be any fixed.

Hello,

This seems like a haxe 4 regression (works fine on 3.4.7) =/ Maybe you should open an issue on github?

For some reason, this works with

private var _field:haxe.ds.StringMap<haxe.ds.StringMap<Dynamic>> = [ "'key'" => new Map<String, Dynamic>() ];

yeah, it even works like this:

private var _field:Map<String, StringMap<Dynamic>> = [ "'key'" => new Map<String, Dynamic>() ];

Maybe you should open an issue on github?

Done