Skip to content

Dartanalyzer unused-variable hint is incorrect #29478

Closed
@mkustermann

Description

@mkustermann

Here is an example where a variable is used but the analyzer thinks it is not used:

class Foo {
  Foo operator |(Foo _) {
    return this;
  }
}
main() {
  var f = new Foo();
  f |= new Foo();
}
$ dartanalyzer test.dart
Analyzing [test.dart]...
[hint] The value of the local variable 'f' isn't used. (test.dart, line 9, col 7)
1 hint found.
$ dartanalyzer --version
 dartanalyzer version 1.22.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions