HaxeFoundation / HaxeFoundation/haxe
[null-safety] final vs. constructor throw
Open
feature-null-safety
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
class C {
final s:String;
public function new() {
if (Math.random() > 0.5) {
throw "no";
} else {
s = "foo";
}
}
}
```
`Null safety: Field "s" is not nullable thus should have an initial value or should be initialized in constructor.`
This is not accurate because _if_ we get an object from the constructor the field will be assigned to.
Contributor guide
Assessment
This issue has not been assessed yet.