Skip to content

Crash for package as type in case class parameter #9289

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
sir-wabbit opened this issue Jul 5, 2020 · 2 comments
Closed

Crash for package as type in case class parameter #9289

sir-wabbit opened this issue Jul 5, 2020 · 2 comments

Comments

@sir-wabbit
Copy link

Minimized code

I am not entirely sure what is so special about annotation package specifically.

// AE-849ee60dd96904e7816fa161283ffe67aac01aea
case class i0(I1: annotation)

This one compiles:

class i0(I1: annotation)

Output (click arrow to expand)

error while transforming (I1: annotation) extends Object(), _root_.scala.Product, _root_.scala.
  Serializable
 {
  val I1: annotation
  def copy(I1: annotation): i0 = new i0(I1)
  def copy$default$1: annotation.type =
    i0.this.I1:(i0.this.I1 : annotation) @uncheckedVariance
  def _1: annotation = this.I1
}
error while transforming @scala.annotation.internal.SourceFile("test.scala") case class i0(I1: annotation
  )
 extends Object(), _root_.scala.Product, _root_.scala.Serializable {
  val I1: annotation
  def copy(I1: annotation): i0 = new i0(I1)
  def copy$default$1: annotation.type =
    i0.this.I1:(i0.this.I1 : annotation) @uncheckedVariance
  def _1: annotation = this.I1
}
error while transforming package <empty> {
  @scala.annotation.internal.SourceFile("test.scala") case class i0(
    I1: annotation
  ) extends Object(), _root_.scala.Product, _root_.scala.Serializable {
    val I1: annotation
    def copy(I1: annotation): i0 = new i0(I1)
    def copy$default$1: annotation.type =
      i0.this.I1:(i0.this.I1 : annotation) @uncheckedVariance
    def _1: annotation = this.I1
  }
  final lazy module val i0: i0$ = new i0$()
  final module class i0$() extends Object(), Function1[annotation, i0], _root_.
    scala
  .Serializable { this: i0.type =>
    def apply(I1: annotation): i0 = new i0(I1)
    def unapply(x$1: i0): i0 = x$1
  }
}
exception occurred while compiling test.scala
java.lang.AssertionError: assertion failed: no member this.I1 . ==, members = Scope{
  class switch?
  final lazy module object switch?
  final module object switch$: <notype>
  class implicitAmbiguous?
  final lazy module object implicitAmbiguous?
  final module object implicitAmbiguous$: <notype>
  trait ClassfileAnnotation?
  final lazy module object ClassfileAnnotation?
  final module object ClassfileAnnotation$: <notype>
  trait TypeConstraint?
  final lazy module object TypeConstraint?
  final module object TypeConstraint$: <notype>
  class unspecialized?
  final lazy module object unspecialized?
  final module object unspecialized$: <notype>
  class varargs?
  final lazy module object varargs?
  final module object varargs$: <notype>
  class unused?
  final lazy module object unused?
  final module object unused$: <notype>
  final class implicitNotFound?
  final lazy module object implicitNotFound?
  final module object implicitNotFound$: <notype>
  final private[scala] class migration?
  final lazy module object migration?
  final module object migration$: <notype>
  class strictfp?
  final lazy module object strictfp?
  final module object strictfp$: <notype>
  final class compileTimeOnly?
  final lazy module object compileTimeOnly?
  final module object compileTimeOnly$: <notype>
  abstract class Annotation extends Object {} at
    (scala.annotation : annotation.type)
  final lazy module object Annotation?
  final module object Annotation$: <notype>
  class nowarn?
  final lazy module object nowarn?
  final module object nowarn$?
  abstract trait StaticAnnotation extends scala.annotation.Annotation {} at
    (scala.annotation : annotation.type)
  final lazy module object StaticAnnotation?
  final module object StaticAnnotation$: <notype>
  trait ConstantAnnotation?
  final lazy module object ConstantAnnotation?
  final module object ConstantAnnotation$: <notype>
  final class tailrec?
  final lazy module object tailrec?
  final module object tailrec$: <notype>
  class showAsInfix?
  final lazy module object showAsInfix?
  final module object showAsInfix$?
  final class elidable?
  final lazy module object elidable?
  final module object elidable$?
  class threadUnsafe?
  final lazy module object threadUnsafe?
  final module object threadUnsafe$: <notype>
  class alpha?
  final lazy module object alpha?
  final module object alpha$: <notype>
  trait RefiningAnnotation?
  final lazy module object RefiningAnnotation?
  final module object RefiningAnnotation$: <notype>
  class infix?
  final lazy module object infix?
  final module object infix$: <notype>
  class static?
  final lazy module object static?
  final module object static$: <notype>
  class superTrait?
  final lazy module object superTrait?
  final module object superTrait$: <notype>
  class constructorOnly?
  final lazy module object constructorOnly?
  final module object constructorOnly$: <notype>
  final lazy module object unchecked: scala.annotation.unchecked
  final module object unchecked extends  {this: scala.annotation.unchecked.type
     =>
  } at (scala.annotation : annotation.type)
  final lazy module object meta: scala.annotation.meta
  final module object meta extends  {this: scala.annotation.meta.type =>} at
    (scala.annotation : annotation.type)
  final lazy module object internal: scala.annotation.internal
  final module object internal extends  {this: scala.annotation.internal.type =>
    } at
  (scala.annotation : annotation.type)
} while compiling test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: no member this.I1 . ==, members = Scope{
  class switch?
  final lazy module object switch?
  final module object switch$: <notype>
  class implicitAmbiguous?
  final lazy module object implicitAmbiguous?
  final module object implicitAmbiguous$: <notype>
  trait ClassfileAnnotation?
  final lazy module object ClassfileAnnotation?
  final module object ClassfileAnnotation$: <notype>
  trait TypeConstraint?
  final lazy module object TypeConstraint?
  final module object TypeConstraint$: <notype>
  class unspecialized?
  final lazy module object unspecialized?
  final module object unspecialized$: <notype>
  class varargs?
  final lazy module object varargs?
  final module object varargs$: <notype>
  class unused?
  final lazy module object unused?
  final module object unused$: <notype>
  final class implicitNotFound?
  final lazy module object implicitNotFound?
  final module object implicitNotFound$: <notype>
  final private[scala] class migration?
  final lazy module object migration?
  final module object migration$: <notype>
  class strictfp?
  final lazy module object strictfp?
  final module object strictfp$: <notype>
  final class compileTimeOnly?
  final lazy module object compileTimeOnly?
  final module object compileTimeOnly$: <notype>
  abstract class Annotation extends Object {} at
    (scala.annotation : annotation.type)
  final lazy module object Annotation?
  final module object Annotation$: <notype>
  class nowarn?
  final lazy module object nowarn?
  final module object nowarn$?
  abstract trait StaticAnnotation extends scala.annotation.Annotation {} at
    (scala.annotation : annotation.type)
  final lazy module object StaticAnnotation?
  final module object StaticAnnotation$: <notype>
  trait ConstantAnnotation?
  final lazy module object ConstantAnnotation?
  final module object ConstantAnnotation$: <notype>
  final class tailrec?
  final lazy module object tailrec?
  final module object tailrec$: <notype>
  class showAsInfix?
  final lazy module object showAsInfix?
  final module object showAsInfix$?
  final class elidable?
  final lazy module object elidable?
  final module object elidable$?
  class threadUnsafe?
  final lazy module object threadUnsafe?
  final module object threadUnsafe$: <notype>
  class alpha?
  final lazy module object alpha?
  final module object alpha$: <notype>
  trait RefiningAnnotation?
  final lazy module object RefiningAnnotation?
  final module object RefiningAnnotation$: <notype>
  class infix?
  final lazy module object infix?
  final module object infix$: <notype>
  class static?
  final lazy module object static?
  final module object static$: <notype>
  class superTrait?
  final lazy module object superTrait?
  final module object superTrait$: <notype>
  class constructorOnly?
  final lazy module object constructorOnly?
  final module object constructorOnly$: <notype>
  final lazy module object unchecked: scala.annotation.unchecked
  final module object unchecked extends  {this: scala.annotation.unchecked.type
     =>
  } at (scala.annotation : annotation.type)
  final lazy module object meta: scala.annotation.meta
  final module object meta extends  {this: scala.annotation.meta.type =>} at
    (scala.annotation : annotation.type)
  final lazy module object internal: scala.annotation.internal
  final module object internal extends  {this: scala.annotation.internal.type =>
    } at
  (scala.annotation : annotation.type)
}
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.ast.Trees$Instance.applyOverloaded(Trees.scala:1559)
	at dotty.tools.dotc.ast.tpd$TreeOps$.equal$extension(tpd.scala:943)
	at dotty.tools.dotc.transform.SyntheticMembers.$anonfun$11(SyntheticMembers.scala:233)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.transform.SyntheticMembers.equalsBody$1(SyntheticMembers.scala:233)
	at dotty.tools.dotc.transform.SyntheticMembers.syntheticRHS$1(SyntheticMembers.scala:125)
	at dotty.tools.dotc.transform.SyntheticMembers.syntheticDef$3$$anonfun$2$$anonfun$1(SyntheticMembers.scala:134)
	at dotty.tools.dotc.transform.SyntheticMembers.synthesizeDef$$anonfun$1(SyntheticMembers.scala:84)
	at dotty.tools.dotc.ast.tpd$.polyDefDef(tpd.scala:287)
	at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:225)
	at dotty.tools.dotc.transform.SyntheticMembers.synthesizeDef(SyntheticMembers.scala:84)
	at dotty.tools.dotc.transform.SyntheticMembers.syntheticDef$1(SyntheticMembers.scala:134)
	at dotty.tools.dotc.transform.SyntheticMembers.syntheticDefIfMissing$1(SyntheticMembers.scala:106)
	at dotty.tools.dotc.transform.SyntheticMembers.caseAndValueMethods$$anonfun$1(SyntheticMembers.scala:355)
	at scala.collection.immutable.List.flatMap(List.scala:293)
	at dotty.tools.dotc.transform.SyntheticMembers.caseAndValueMethods(SyntheticMembers.scala:355)
	at dotty.tools.dotc.transform.SyntheticMembers.addSyntheticMembers(SyntheticMembers.scala:531)
	at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform$$anonfun$4(PostTyper.scala:295)
	at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.withNoCheckNews(PostTyper.scala:97)
	at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:296)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1349)
	at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:54)
	at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:318)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1371)
	at scala.collection.immutable.List.mapConserve(List.scala:472)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1371)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1369)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1356)
	at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:54)
	at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:380)
	at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:318)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:319)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:180)
	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:190)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:198)
	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:205)
	at dotty.tools.dotc.Run.compileSources(Run.scala:142)
	at dotty.tools.dotc.Run.compile(Run.scala:124)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:194)
	at dotty.tools.dotc.Driver.process(Driver.scala:163)
	at dotty.tools.dotc.Driver.process(Driver.scala:175)
	at dotty.tools.dotc.Driver.main(Driver.scala:202)
	at dotty.tools.dotc.Main.main(Main.scala)
@bishabosha
Copy link
Member

i believe this works with any package

@bishabosha bishabosha changed the title Using annotation package as a type in a case class results in a crash. Crash for package as type in case class parameter Jul 5, 2020
@griggt
Copy link
Contributor

griggt commented Apr 9, 2022

Fixed by #14888

@griggt griggt closed this as completed Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants