Skip to content

For comprehension bug when using type casting #21544

Closed
@road21

Description

@road21

Compiler version

3.5.0, 3.3.3

Minimized code

https://scastie.scala-lang.org/road21/GozkhzC7QXaGpkbM7mNYUg/3

for {
  (x: Any) <- (List[Boolean]())
} yield x

Output

Compile error:

[error] cannot test if value of type Boolean is a reference of class Object
[error]   (x: Any) <- (List[Boolean]())
[error]    ^^^^^^

Expectation

No compiler error

Same code works fine in Scala 2.13

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions