Skip to content

Fix #5411: varargs with intersection type elements #5632

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 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Constants._
import Decorators._
import Denotations._, SymDenotations._
import dotty.tools.dotc.ast.tpd
import TypeErasure.erasure
import DenotTransformers._

object ElimRepeated {
Expand Down Expand Up @@ -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.

ref(defn.DottyArraysModule)
.select(nme.seqToArray)
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i5411.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trait A
trait B
object O {
def m(x: Seq[A & B]) = java.util.Arrays.asList(x: _*)
}