Skip to content

Incorrect type test of union types via type alias #1490

Closed
@liufengyun

Description

@liufengyun
class Base {
  type T = Int | Boolean
  def test(x: Object) = x.isInstanceOf[T]
}

object Test {
  def main(args: Array[String]) = {
    val b = new Base
    println(b.test(Int.box(3)))                   
    println(b.test(Double.box(3.4)))    // should be false, but true
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions