Skip to content

Top level value class object crashes the compiler #2470

Closed
@nicolasstucki

Description

@nicolasstucki
 object Foo extends AnyVal

emits the unhelpful warning

1  |  object Foo extends AnyVal
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^
   |  object Foo has already been compiled
   |  once during this run

and then crashes with

Exception in thread "main" java.lang.AssertionError: assertion failed
	at scala.Predef$.assert(Predef.scala:156)
	at dotty.tools.dotc.ast.Trees$$anonfun$flatten$1.apply(Trees.scala:753)
	at dotty.tools.dotc.ast.Trees$$anonfun$flatten$1.apply(Trees.scala:752)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at dotty.tools.dotc.ast.Trees$.flatten(Trees.scala:752)
	at dotty.tools.dotc.typer.Namer.dotty$tools$dotc$typer$Namer$$recur$1(Namer.scala:428)
	at dotty.tools.dotc.typer.Namer.indexExpanded(Namer.scala:444)
	at dotty.tools.dotc.typer.Namer.index(Namer.scala:417)
	at dotty.tools.dotc.typer.FrontEnd$$anonfun$enterSyms$1.apply$mcV$sp(FrontEnd.scala:52)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:32)
	at dotty.tools.dotc.typer.FrontEnd.enterSyms(FrontEnd.scala:50)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:89)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:82)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:79)
	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:79)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:67)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:67)
	at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:76)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:67)
	at dotty.tools.dotc.Run.compileSources(Run.scala:64)
	at dotty.tools.dotc.Run.compile(Run.scala:48)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:26)
	at dotty.tools.dotc.Driver.process(Driver.scala:124)
	at dotty.tools.dotc.Driver.process(Driver.scala:93)
	at dotty.tools.dotc.Driver.process(Driver.scala:105)
	at dotty.tools.dotc.Driver.main(Driver.scala:132)
	at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions