HaxeFoundation / HaxeFoundation/haxe

[null safety] Unhelpful error message on argument mismatch for inline call

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

Description

```haxe
@:nullSafety
class Test {
inline static function func(a:String, b:String) {
return a + b;
}

static function main() {
func(null, "");
}
}
```

```
[ERROR] Test.hx:8: characters 5-19

8 | func(null, "");
| ^^^^^^^^^^^^^^
| Null safety: Cannot assign nullable value here.
```

Compare with no inline:
```
[ERROR] Test.hx:8: characters 10-14

8 | func(null, "");
| ^^^^
| Null safety: Cannot pass nullable value to not-nullable argument "a" of function "func".
```

If it is a regular unification error, the message is the same for inline and non-inline, so hopefully the same could be achieved for null safety unification errors?

Contributor guide

Open the contributing guide

Research direction

Start with the Test.hx reproducer in the issue and compare compiler diagnostics for the inline and non-inline calls. Trace the null-safety unification error handling for inline calls; done means the inline case reports the offending argument and function parameter consistently with the non-inline case.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.