HaxeFoundation / HaxeFoundation/haxe

Better error range for missing return

Open
#10,929 0 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 typo makes full function body red:
```haxe
class Main {
static function main() {}

static function find(stacks:Array>, card:Int):Null {
for (stack in stacks) {
final last = stack[stack.length - 1];
if (card == last) {
return 0;
}
return null;
}
}
}
```
Some alternatives for less verbose error:
image
image

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the diagnostic with the Haxe example in the issue and compare the reported range with the alternatives shown in the attached images. Trace the compiler's missing-return diagnostic and adjust its range so the error highlights a narrower, more useful location; done means the example reports the improved range.

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.