Skip to content

AssertionError: duplicate attachment when calling method with default arguments in mutliple given parameter lists #8151

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

Closed
panacekcz opened this issue Jan 30, 2020 · 0 comments

Comments

@panacekcz
Copy link
Contributor

minimized code

trait A
trait B
object O{
  def m(given x:A = null)(given y:B = null) = 1
  def n = m
}

Crash output (click arrow to expand)

exception occurred while typechecking given-default.scala
exception occurred while compiling given-default.scala
java.lang.AssertionError: assertion failed: duplicate attachment for key dotty.tools.dotc.util.Property$StickyKey@31c2affc while compiling given-default.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: duplicate attachment for key dotty.tools.dotc.util.Property$StickyKey@31c2affc
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.util.Attachment$Container.pushAttachment(Attachment.scala:118)
	at dotty.tools.dotc.ast.Trees$Tree.pushAttachment(Trees.scala:55)
	at dotty.tools.dotc.ast.Trees$Apply.setGivenApply(Trees.scala:443)
	at dotty.tools.dotc.typer.Typer.addImplicitArgs$2$$anonfun$2(Typer.scala:2765)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2375)
	at dotty.tools.dotc.typer.Typer.addImplicitArgs$4(Typer.scala:2770)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$2(Typer.scala:2787)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2957)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3185)
	at dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2578)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2579)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.addImplicitArgs$2$$anonfun$2(Typer.scala:2767)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2375)
	at dotty.tools.dotc.typer.Typer.addImplicitArgs$4(Typer.scala:2770)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$2(Typer.scala:2787)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2957)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3185)
	at dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2578)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2579)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1267)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1257)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1267)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1401)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1412)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1413)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1424)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1432)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1504)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:815)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:935)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:843)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:258)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:185)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:187)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:398)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2103)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2128)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1812)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2141)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1938)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2182)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:305)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:167)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:177)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:185)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:192)
	at dotty.tools.dotc.Run.compileSources(Run.scala:129)
	at dotty.tools.dotc.Run.compile(Run.scala:112)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
	at dotty.tools.dotc.Driver.process(Driver.scala:189)
	at dotty.tools.dotc.Driver.process(Driver.scala:158)
	at dotty.tools.dotc.Driver.process(Driver.scala:170)
	at dotty.tools.dotc.Driver.main(Driver.scala:197)
	at dotty.tools.dotc.Main.main(Main.scala)
@odersky odersky closed this as completed in 8d755c2 Feb 6, 2020
odersky added a commit that referenced this issue Feb 6, 2020
Fix #8151: Make `setGivenApply` more flexible.
giabao added a commit to ohze/akka that referenced this issue Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant