Skip to content

Erasure for Unit.type crash #7814

Closed
@sir-wabbit

Description

@sir-wabbit

minimized code

def i0 = Unit
Stack trace
exception while typing Unit of class class dotty.tools.dotc.ast.Trees$Ident # 1026
exception while typing def i0: Unit.type = Unit of class class dotty.tools.dotc.ast.Trees$DefDef # 1027
exception while typing @scala.annotation.internal.SourceFile("testing/Test.scala") final module class
  Test$package$
() extends Object(), Serializable {
  private def writeReplace(): AnyRef =
    new scala.runtime.ModuleSerializationProxy(classOf[Test$package.type])
  def i0: Unit.type = Unit
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1139
exception while typing package <empty> {
  final lazy module val Test$package: Test$package$ = new Test$package$()
  @scala.annotation.internal.SourceFile("testing/Test.scala") final module class

  Test$package$() extends Object(), Serializable {
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Test$package.type])
    def i0: Unit.type = Unit
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 1140
exception occurred while compiling testing/Test.scala
java.lang.AssertionError: assertion failed: typer while compiling testing/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: typer
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.transform.Erasure$Typer.adapt(Erasure.scala:753)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2548)
	at dotty.tools.dotc.typer.Applications$TypedApply.addArg(Applications.scala:697)
	at dotty.tools.dotc.typer.Applications$TypedApply.addArg(Applications.scala:696)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:533)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:602)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:694)
	at dotty.tools.dotc.typer.Applications$ApplyToTyped.<init>(Applications.scala:804)
	at dotty.tools.dotc.ast.tpd$.applyOverloaded(tpd.scala:1183)
	at dotty.tools.dotc.ast.tpd$.resolveConstructor(tpd.scala:1374)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.readAnnotationContents(Scala2Unpickler.scala:947)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.deferredAnnot$$anonfun$2$$anonfun$1(Scala2Unpickler.scala:982)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.atReadPos(Scala2Unpickler.scala:325)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.deferredAnnot$$anonfun$1(Scala2Unpickler.scala:982)
	at dotty.tools.dotc.core.Annotations$$anon$1.complete(Annotations.scala:124)
	at dotty.tools.dotc.core.Annotations$LazyAnnotation.tree(Annotations.scala:56)
	at dotty.tools.dotc.core.Annotations$Annotation.arguments(Annotations.scala:29)
	at dotty.tools.dotc.core.Annotations$Annotation.argument(Annotations.scala:32)
	at dotty.tools.dotc.core.Annotations$Annotation.argumentConstant(Annotations.scala:36)
	at dotty.tools.dotc.transform.Erasure$Typer.checkNotErased(Erasure.scala:353)
	at dotty.tools.dotc.transform.Erasure$Typer.typedIdent(Erasure.scala:406)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2098)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1653)
	at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:635)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2106)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:747)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1784)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2109)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:747)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1910)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2150)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
	at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:100)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
	at scala.collection.immutable.List.map(List.scala:219)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:161)
	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:171)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:179)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:186)
	at dotty.tools.dotc.Run.compileSources(Run.scala:123)
	at dotty.tools.dotc.Run.compile(Run.scala:106)
	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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions