HaxeFoundation / HaxeFoundation/haxe

[PHP] "This code has no effect" diagnostic on Array.push

Open
#10,927 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

```haxe
class Main {
static function main() {
var arr = [];
arr.push("haxe");
}
}
```

when you target PHP and open a file in VSCode that uses `Array.push` it looks fine at first, but once you save that file lines with push operations show "This code has no effect" diagnostic and they get greyed out.

I tried a few other targets and they don't seem to be affected.

it appears the issue started with build `3e34d27` in march last year, because it doesn't happen in `2cbe1d0`.

Contributor guide

Open the contributing guide

Research direction

Start with the provided Array.push example in VSCode targeting PHP, then compare the behavior at commits 2cbe1d0 and 3e34d27. Trace the diagnostic that greys out push operations and verify that saving the example no longer reports “This code has no effect” for the PHP target.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, vscode
Domain
compilers, developer-experience
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.