Skip to content

False positive unused pattern variable warnings in 3.7 nightly on lazy val tuple destructuring #22743

Closed
@mrdziuban

Description

@mrdziuban

Compiler version

3.7.0-RC1-bin-20250306-73ba485-NIGHTLY

Minimized code

With -Wunused:unsafe-warn-patvars enabled:

def foo: (Int, String) = (1, "foo")
lazy val (i, s) = foo

Output

-- [E198] Unused Symbol Warning: /Users/matt/scala3.7-nightly-unused/src/main/scala/example/Test.scala:2:10 ------------
2 |lazy val (i, s) = foo
  |          ^
  |          unused pattern variable
-- [E198] Unused Symbol Warning: /Users/matt/scala3.7-nightly-unused/src/main/scala/example/Test.scala:2:13 ------------
2 |lazy val (i, s) = foo
  |             ^
  |             unused pattern variable

Expectation

The values should not be reported unused because they're public

Metadata

Metadata

Assignees

Labels

area:lintingLinting warnings enabled with -W or -Xlintitype:bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions