Skip to content

Fix #3548: set outer select type to be the type enclosing the expected type #3551

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

Merged
merged 2 commits into from
Dec 23, 2017

Conversation

liufengyun
Copy link
Contributor

Fix #3548: set outer select type to be the type enclosing the expected type.

Otherwise, ElimOuterSelect will insert ensureConforms(tp) in outer test, which causes run-time exception.

case O2.Data(s) => println("O2 data")
case _ => println("Unknown")
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose a slight modification to the test:

val result = data match {
  case O1.Data(s) => 1
  case O2.Data(s) => 2
  case _ => 3
}
assert(result == 2)

@allanrenucci allanrenucci requested a review from odersky November 27, 2017 15:03
@odersky odersky self-assigned this Dec 11, 2017
…pected type

Otherwise, ElimOuterSelect will insert `ensureConforms(tp)` in outer test,
which causes run-time exeception.
@odersky
Copy link
Contributor

odersky commented Dec 23, 2017

I had doubts at first, but after looking into it more deeply this appears to be the right fix. LGTM

@odersky odersky merged commit f4abdd8 into scala:master Dec 23, 2017
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

Successfully merging this pull request may close these issues.

3 participants