Skip to content

False unused local definition passing NamedTuple as Tuple #24263

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.7.4-RC2, 3.8.0-RC1-bin-20251026-5c51b7b-NIGHTLY

Works as expected on 3.7.3, 3.7.4-RC1

Minimized code

object test {
  def f(t: Tuple): Nothing = ???
  val _ = (inputTuple: NamedTuple.NamedTuple[Tuple, Tuple]) => f(inputTuple)
}

Output

$ scala-cli compile --server=false -S 3.7.4-RC2 -Wall as_expr_3.7.4_rc2.scala 
-- [E198] Unused Symbol Warning: /home/ejbyfeldt/dev/scala_playground/as_expr_3.7.4_rc2.scala:3:65 
3 |  val _ = (inputTuple: NamedTuple.NamedTuple[Tuple, Tuple]) => f(inputTuple)
  |                                                                 ^
  |                                                   unused local definition
1 warning found

Expectation

No warning should be generated.

Metadata

Metadata

Assignees

Labels

area:lintingLinting warnings enabled with -W or -Xlintarea:named-tuplesIssues tied to the named tuples feature.itype:bugregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions