HaxeFoundation / HaxeFoundation/haxe

switch on Dynamic

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

Description

Hej,

First of all, I know using Dynamic is really kamikaze thing, but I just want to know if it's a switch bug or if it's definitivly like "we don't support Dynamic anymore :rofl:"

Consider this example :
```haxe
enum Foo{
FBar1;
FBar2;
}
class Test {
static function main() {
var o : Dynamic = "test";
switch o {
case null:
trace( "null case" );
case FBar1:
trace( "Fbar 1");
case FBar2:
trace( "Fbar 2");
case _:
trace( o );
}
}
}
```
Here it doesn't trace anything, but if we comment the 2 cases FBar1 and FBar2, it do trace "test" as expected : https://try.haxe.org/#d0C0Bd50

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.