Skip to content

-Wunused false negative in for-comprehension #18289

Closed
@myazinn

Description

@myazinn

Compiler version

3.3.0, 3.3.1-RC4

Minimized code

With -Wunused:all

@main def run(): Unit =
  val dummy = 1
  for x <- Option(1)
  yield dummy

or

@main def run(): Unit =
  for
    x <- Option(1)
    y <- Option(2)
  yield y

Output

The code compiles without warnings

Expectation

The code produces an unused local definition warning for an x variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions