Skip to content

False positive [E198] Unused Symbol Warning #24280

@durban

Description

@durban

Compiler version

3.3.7

Minimized code

class Foo {
  def foo(): Any = {
    var i = 0 // <- warning here
    val f = () => i += 1
    f
  }
}

Output

[warn] -- [E198] Unused Symbol Warning: .../ThunkSuite.scala:3:8
[warn] 3 |    var i = 0
[warn]   |        ^
[warn]   |        unused local definition

Expectation

No warning (as i is not unused; in fact, if I remove i, that results in an error).

Related: typelevel/cats-effect#4519

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lintingLinting warnings enabled with -W or -Xlintitype:bugstat:fixed in nextThe issue was fixed in Next and only still applies to LTS.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions