Skip to content
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

Fix #5411: varargs with intersection type elements #5632

Merged
merged 1 commit into from
Dec 17, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 17, 2018

We need to generate a ClassTag to construct a Java vararg array.
Just computing the class symbol of the element type is not enough,
as some types do not have class symbols. We need instead to compute
the class symbol on the erased element type.

We need to generate a ClassTag to construct a Java vararg array.
Just computing the class symbol of the element type is not enough,
as some types do not have class symbols. We need instead to compute
the class symbol on the erased element type.
@odersky odersky added the fasttrack Simple fix. Reviewer should merge or apply additional changes directly. label Dec 17, 2018
@@ -92,7 +93,7 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
JavaSeqLiteral(elems, elemtpt)
case _ =>
val elemType = tree.tpe.elemType
var elemClass = elemType.classSymbol
var elemClass = erasure(elemType).classSymbol
if (defn.NotRuntimeClasses.contains(elemClass)) elemClass = defn.ObjectClass
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this line still needed if we erase the elemType?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure about NullClass, NothingClass. I think these survive erasure.

@odersky odersky merged commit 0d00e2c into scala:master Dec 17, 2018
@allanrenucci allanrenucci deleted the fix-#5411 branch December 17, 2018 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fasttrack Simple fix. Reviewer should merge or apply additional changes directly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants