HaxeFoundation / HaxeFoundation/haxe

structInit creates a "non-exist" but typeable constructor

Open
#9,567 3 comments 0 reactions 0 assignees View on GitHub
error-reporting feature-structInit
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
class Main{
static function main() {
$type(Foo.new);
}
}

@:structInit
class Foo {
@:optional var foo:Int;
}
```

```
src/Main.hx:3: characters 9-16 : Foo does not have a constructor
src/Main.hx:3: characters 9-16 : Warning : (foo : Null) -> Foo
```

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.