HaxeFoundation / HaxeFoundation/haxe

Type param @:const abstract with constructor fails.

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

Description

```haxe
//compiler errors: Type parameter is expected to be a constant value
@:generic
abstract Data<@:const V:Int>(Any) {
public function new() {} //specfically the failure begins when the new function is typed, without a constructor it works.
}
//it works without a new constructor
@:generic
abstract Data3<@:const V:Int>(Any) {}
//the class version works
@:generic
class Data2<@:const V:Int> {
public function new() {}
}
```
https://try.haxe.org/#30254cf2

Tested on latest nightly through 3.4.7 same result.

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.