Skip to content

Incorrect type test of union types via type alias #1490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
liufengyun opened this issue Aug 31, 2016 · 0 comments
Closed

Incorrect type test of union types via type alias #1490

liufengyun opened this issue Aug 31, 2016 · 0 comments
Assignees

Comments

@liufengyun
Copy link
Contributor

liufengyun commented Aug 31, 2016

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
  }
}
@liufengyun liufengyun changed the title Incorrect type test of type alias for union types Incorrect type test of union types via type alias Aug 31, 2016
liufengyun added a commit to dotty-staging/dotty that referenced this issue Aug 31, 2016
@liufengyun liufengyun self-assigned this Aug 31, 2016
@smarter smarter closed this as completed in 9a5a517 Sep 1, 2016
smarter added a commit that referenced this issue Sep 1, 2016
Fix #1490: type test of union types via type alias
MasseGuillaume pushed a commit to MasseGuillaume/dotty that referenced this issue Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants