HaxeFoundation / HaxeFoundation/haxe

Null<T> should not satisfy type constraint T

Open
#12,020 4 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

This compiles fine and leads to a null access error:

```haxe
function getLength(v:T) {
return v.length;
}

function main() {
final nullable:Null = null;
trace(getLength(nullable));
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the minimal Haxe program in the issue with the compiler and observe how Null is accepted for the T:String constraint. Trace the compiler's generic constraint and nullability checking paths; done means the invalid call is rejected or the constraint is enforced consistently without the null access shown.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.