HaxeFoundation / HaxeFoundation/haxe

An EitherType constraint causes oddities when used as a map key

Open
#11,401 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Sample:
```haxe
import haxe.extern.EitherType;

@:keep class Test {
static function main() {
var tc = new Impl();
trace(tc.labels[One]);
}
}
abstract class Base> {
public var labels:Map = new Map();
public function new() {}
}
class Impl extends Base {

}
enum ETest {
One;
Two;
}
```
So, two things:
1. Perhaps this should not compile unless there's a multitype that can accept both key types.
2. On JS with `-dce full`, this results in compiler picking StringMap but culling its get() method, causing a runtime error.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.