HaxeFoundation / HaxeFoundation/haxe

[hl] hl-check fails for switch statement with generic parameter

Open
#9,708 5 comments 0 reactions 1 assignee Claimed by @ncannasse View on GitHub
bug platform-hl
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

**Haxe Version:** 4.1.2
**HashLink Version:** 1.11.0, haxelib 0.1.0
```haxe
class SwitchTest
{
public static function main() { }

static function foo(bar:T)
{
// To reproduce the bug, there must be at least two non-default cases,
// and at least one of the case values must be negative.
switch (bar)
{
case -1: 0; // The expression doesn't matter.
case 1: 0;
default: 0;
}
}
}
```
Building this example with `haxe --hl test.hl -m SwitchTest -D hl-check` produces the following:
```
Error:
SwitchTest.hx:13: Check failure at fun@244 @1 - Register 2(f64) should be dyn and not f64
```
I originally discovered this bug when trying to build Flixel 4.8.0 for the HashLink target.

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.