HaxeFoundation / HaxeFoundation/haxe
Null safety error for iterating on nullable could be improved
Open
enhancement
error-reporting
feature-null-safety
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
@:nullSafety class Main {
static var a:Null>;
static function main() {
for (i in a) {}
}
}
```
```
source/Main.hx:5: characters 3-18 : Null safety: Cannot perform array access on nullable value.
source/Main.hx:5: characters 3-18 : Null safety: Cannot access "length" of a nullable value.
```
The errors are slightly confusing, because the user is not actually perfoming array access or accessing `length` in that line. "Cannot iterate on nullable value" would be better.
Contributor guide
Assessment
This issue has not been assessed yet.