HaxeFoundation / HaxeFoundation/haxe

Void->Void unification not strict enough

Open
#9,325 3 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
class Main {
public static function main() {
foo(() -> function() {
trace('whoops'); // Never called, anyway
});
}

static function foo(cb:Void->Void) {
cb();
}
}
```

I was lacking coffee and made this "typo" while refactoring some code... and haxe doesn't complain (both 4.0.5 and recent dev (`af197e3` from 2020-04-09)).

Contributor guide

Open the contributing guide

Research direction

Start by compiling the provided Main example with Haxe 4.0.5 or the referenced development revision and confirm that the callback is accepted. Trace the compiler's function-type unification or type-checking path for Void->Void; done means this example is rejected with a useful type error while valid Void->Void callbacks still compile.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.