Skip to content

Spurious is instanceOf warning #4297

Closed
Closed
@liufengyun

Description

@liufengyun

As reported by @allanrenucci in #4245, the following code will get a warning saying Some[Int] cannot be checked at runtime.

class Test {
  def test[X <: Option[Int]](x: X) = x.isInstanceOf[Some[Int]]
}

Initial diagnosis shows that type inference somehow failed to infer a <: Int, given Some[a] <: X and X <: Option[Int].

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions