HaxeFoundation / HaxeFoundation/haxe

Constant loop unroll creates invalid position

Open
#7,664 1 comment 0 reactions 0 assignees View on GitHub
bug platform-hl
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

When compiler does loop unroll here:

```haxe
class Main {
static function main() {
var arr = [[]];
for( i in 0...5 )
if( i <= arr.length )
arr[i].push(i);
}
}
```

It produces invalid position:

```
haxe -hl main.hl -main Main && hl main.hl
Uncaught exception: Null access
Called from $Main.main(Main.hx:4) <-- should be line 6 !
Called from fun$331(?:1)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.