Skip to content

Erasure incorrectly rewrites isInstanceOf[X & Y] as isInstanceOf[X] #2084

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
smarter opened this issue Mar 12, 2017 · 6 comments
Closed

Erasure incorrectly rewrites isInstanceOf[X & Y] as isInstanceOf[X] #2084

smarter opened this issue Mar 12, 2017 · 6 comments

Comments

@smarter
Copy link
Member

smarter commented Mar 12, 2017

It should be rewritten as isInstanceOf[X] && isInstanceOf[Y] of course.
Test case that should run without asserting:

trait X
trait Y

object Test {
  def main(args: Array[String]): Unit = {
    val x: Any = new X {}
    assert(!x.isInstanceOf[X & Y])
  }
}
@DarkDimius
Copy link
Contributor

DarkDimius commented Mar 12, 2017 via email

@smarter
Copy link
Member Author

smarter commented Mar 12, 2017

No, I think this should be handled by TypeTestCasts which already handles rewriting isInstanceOf[A | B]

@DarkDimius
Copy link
Contributor

DarkDimius commented Mar 12, 2017

@smarter, I guess you're right. I remembered that there was a phase before easure that did it, so I've assumed that's splitter.
Apparently I was the one to roll it into erasure 2 years ago.

@DarkDimius DarkDimius self-assigned this Mar 13, 2017
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Mar 13, 2017
@DarkDimius
Copy link
Contributor

Please don't spam "prio:high" this bug doesn't block anything and shouldn't have high priority.

@smarter
Copy link
Member Author

smarter commented Mar 13, 2017

  1. I don't think I "spam" anything, besides this one, there are only two other open issues I've marked prio:high. I've been basically the only person triaging issues for the past few months, but I'll stop if it's not appreciated.
  2. prio:high doesn't mean "blocker" to me, here's the classification I use:
    • high: This is important to fix soon and should not be forgotten.
    • low: It's okay to not fix it now, we'll get to it eventually.
    • medium: everything else.
    • If something was a blocker, I would use a "blocker" or "prio:critical" tag.
  3. We can discuss the priority levels and their meaning at the next dotty meeting so that everyone agrees on them.

@felixmulder
Copy link
Contributor

felixmulder commented Mar 13, 2017 via email

smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 13, 2017
smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 14, 2017
smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 15, 2017
smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 15, 2017
smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 15, 2017
smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 16, 2017
smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 16, 2017
smarter pushed a commit to dotty-staging/dotty that referenced this issue Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants