HaxeFoundation / HaxeFoundation/haxe
Map with parameterized key
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
@:generic
class MyMap {
public var map: Map = new Map();
public function new() {}
}
```
This code does not compile with error
>Abstract haxe.ds.Map has no @:to function that accepts haxe.IMap
I always thought that this is because underlying type selection occurs before type parameter application. But this is not the case, because I've just discovered that `@:remove` metadata makes this example compile. So now I'm confused, why it does not just work with `@:generic` only.
Also this is not documented in any way, I've only found this mentioned here: https://github.com/HaxeFoundation/haxe/issues/2537
Also it does not help with abstracts. It actually looks like abstracts cannot be generic at all...
```haxe
@:generic @:remove
abstract MyMap(Map) {
public function new() {
this = new Map();
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.