Error: Abstract Map has no @:to function that accepts IMap<Test.T, Test2<Test.T>>

390 views
Skip to first unread message

Miguel Pro Verianto

unread,
Jan 2, 2014, 3:35:58 AM1/2/14
to haxe...@googlegroups.com
Hi, can someone help me with some explanation on why the compiler is throwing the following error for the following code?

Here's the code
http://pastebin.com/dEDxsU27

Error: Abstract Map has no @:to function that accepts IMap<Test.T, Test2<Test.T>>
Error: String should be Test.T

Also, what's the correct terminology to refer to that concept in Haxe actually? Template? Generics? Type Parameter?
I'm having difficulty figuring out what keyword I should use to search for the problem, because searching for Template seems to points me towards the haxe.Template module instead.

Thanks in advance.

cruxblack

unread,
Jan 2, 2014, 3:52:27 AM1/2/14
to haxe...@googlegroups.com
BTW, just ignore the second error, just assume line 23 is written
map[key].val = val;

instead of
map[key].val = key + " " + val;

Juraj Kirchheim

unread,
Jan 2, 2014, 4:49:50 AM1/2/14
to haxe...@googlegroups.com
You cannot do that. You will have to use IMap if the key type is
unknown. I've tried to explain the reasons here:
https://groups.google.com/d/msg/haxelang/g1o7-bcUw2s/iBZI58aAEy0J

Regards,
Juraj
> --
> To post to this group haxe...@googlegroups.com
> http://groups.google.com/group/haxelang?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Haxe" group.
> For more options, visit https://groups.google.com/groups/opt_out.

cruxblack

unread,
Jan 2, 2014, 6:44:26 AM1/2/14
to haxe...@googlegroups.com
Hi, thx for the response, asked around on the Haxe IRC channel for some answers,
I've tried adding @:generic to the classes, but it doesn't work, the compiler still throw out the same error.

However, marking the class as @:generic @:remove seems to work, so I guess its solved for now.
Reply all
Reply to author
Forward
0 new messages