HaxeFoundation / HaxeFoundation/haxe

[analyzer] dead assignment is kept due to earlier usage

Open
#7,724 0 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
feature-analyzer
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Came across some curious behavior of the analyzer's dead code removal - with `-D analyzer-optimize`, `bar = ""` is removed as expected in this case:

```haxe
class Main {
public static function main() {}

function foo(bar:String) {
// trace(bar);
bar = "";
}
}
```

However, once the trace is commented in, it's kept, even though it's before the assignment.

Mostly I was wondering if `bar = ""` could be marked as unused by diagnostics, but the analyzer catching it is a prerequisite I guess. ;)

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.