scala/scala3

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

Closed this issue · 1 comments

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

Note -Wunused:patvars. (Somewhere I removed obsolete options, but that prevents existing CB from building.)

It looks like lazy val is not represented in the test suite.