Skip to content

Fix #1751: Make dominator work after erasure #1769

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 1 commit into from
Dec 10, 2016

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 2, 2016

i1751.scala shows a case where we need to compute the approximation
of an or-type during erasure. This can lead to an empty set of common
classes because Any does not exist anymore after erasure.

Review by @liufengyun ?

i1751.scala shows a case where we need to compute the approximation
of an or-type during erasure. This can lead to an empty set of common
classes because Any does not exist anymore after erasure.
@DarkDimius
Copy link
Contributor

Our of curiosity: where do we construct an Or type during erasure?

@odersky
Copy link
Contributor Author

odersky commented Dec 3, 2016

Our of curiosity: where do we construct an Or type during erasure?

We don't (in this case), actually.It's a type that was left in the unerased tree. The error happens with the third line below in the stacktrace:

override def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = {
  val Apply(fun, args) = tree
  if (fun.symbol == defn.dummyApply)

As you can see, it takes the symbol of the previous unerased tree.

@odersky
Copy link
Contributor Author

odersky commented Dec 3, 2016

Also relevant is the comment on this Config variable:

/** Check that certain types cannot be created in erasedTypes phases.
 *  Note: Turning this option on will get some false negatives, since it is
 *  possible that And/Or types are still created during erasure as the result
 *  of some operation on an existing type.
 */
final val checkUnerased = false

@liufengyun
Copy link
Contributor

@odersky It looks good to me. Following minimised version of test is more intuitive:

object Test {
  def f(x: Int) = if (x > 0) -1 else "String"

  def h = f(3) == 22      //  `== ` triggers the exception
}

OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this pull request Dec 8, 2016
@odersky odersky merged commit 4830901 into scala:master Dec 10, 2016
OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this pull request Dec 12, 2016
@allanrenucci allanrenucci deleted the fix-#1751 branch December 14, 2017 16:59
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