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

NoDenotation.owner on Seq of intersection passed to java varargs #5411

Closed
panacekcz opened this issue Nov 8, 2018 · 1 comment
Closed

NoDenotation.owner on Seq of intersection passed to java varargs #5411

panacekcz opened this issue Nov 8, 2018 · 1 comment

Comments

@panacekcz
Copy link
Contributor

ElimRepeated.seqToArray assumes that the element type has a class symbol.

Code:

trait A
trait B
object O {
  def m(x: Seq[A & B]) = java.util.Arrays.asList(x: _*)
}

Output:

exception occurred while compiling RepeatedSeq.scala
java.lang.AssertionError: NoDenotation.owner while compiling RepeatedSeq.scala
Exception in thread "main" java.lang.AssertionError: NoDenotation.owner
	at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:1929)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.typeRef(SymDenotations.scala:1166)
	at dotty.tools.dotc.transform.ElimRepeated.seqToArray(ElimRepeated.scala:103)
	at dotty.tools.dotc.transform.ElimRepeated.$anonfun$transformApply$2(ElimRepeated.scala:82)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:108)
	at dotty.tools.dotc.transform.ElimRepeated.transformApply(ElimRepeated.scala:78)
	at dotty.tools.dotc.transform.MegaPhase.goApply(MegaPhase.scala:607)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:272)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:392)
	at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:245)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:248)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:391)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$1(MegaPhase.scala:400)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$transformStats$2(MegaPhase.scala:405)
	at scala.collection.immutable.List.mapConserve(List.scala:175)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:405)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:339)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:392)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:391)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$1(MegaPhase.scala:400)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$transformStats$2(MegaPhase.scala:405)
	at scala.collection.immutable.List.mapConserve(List.scala:175)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:405)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:356)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:392)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:411)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:423)
	at dotty.tools.dotc.core.Phases$Phase.$anonfun$runOn$1(Phases.scala:297)
	at scala.collection.immutable.List.map(List.scala:282)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:295)
	at dotty.tools.dotc.core.Phases$Phase.runOn$(Phases.scala:294)
	at dotty.tools.dotc.transform.MegaPhase.runOn(MegaPhase.scala:137)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:172)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:49)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:169)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:167)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:194)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:167)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:192)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:90)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:147)
	at dotty.tools.dotc.Run.compileSources(Run.scala:134)
	at dotty.tools.dotc.Run.compile(Run.scala:118)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:30)
	at dotty.tools.dotc.Driver.process(Driver.scala:136)
	at dotty.tools.dotc.Driver.process(Driver.scala:105)
	at dotty.tools.dotc.Driver.process(Driver.scala:117)
	at dotty.tools.dotc.Driver.main(Driver.scala:144)
	at dotty.tools.dotc.Main.main(Main.scala)
@odersky
Copy link
Contributor

odersky commented Dec 17, 2018

@panacekcz Thanks for these reports! Your reports all have great minimizations which makes diagnosing them really easy. Sorry that we do not get around some of these issues sooner.

odersky added a commit that referenced this issue Dec 17, 2018
Fix #5411: varargs with intersection type elements
nicolasstucki pushed a commit to dotty-staging/dotty that referenced this issue Jan 5, 2019
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.
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

No branches or pull requests

2 participants