HaxeFoundation / HaxeFoundation/haxe
[hl] Invalid inline - type not replaced for FInstance
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
The following code results in an `Uncaught exception: Access violation Called from hl.types.ArrayDyn.get_length` on HL. Works on all other targets.
```haxe
@:forward
abstract OneOrMany(Array) from Array to Array {
@:from
static function fromSingle(value:T):OneOrMany {
return [value];
}
}
class Test {
inline
public static function firstItem(items:Array):T {
return (items == null || items.length == 0) ? null :items[0];
}
public static function traceFirstString(strings:OneOrMany) {
trace(firstItem(strings)); // access violation is raised here
}
public static function main() {
traceFirstString(["ab", "cd"]);
}
}
```
It works when I remove the `inline` declaration from the `firstItem` method
Contributor guide
Assessment
This issue has not been assessed yet.