Skip to content

Double binding error when compiling Option and Seq together #980

Closed
@smarter

Description

@smarter

Note that this does not happen if you reverse the order of the arguments and run -Yno-double-bindings ./scala-scala/src/library/scala/collection/Seq.scala ./scala-scala/src/library/scala/Option.scala instead.

% ./bin/dotc -Yno-double-bindings ./scala-scala/src/library/scala/Option.scala ./scala-scala/src/library/scala/collection/Seq.scala
exception occurred while indexing ./scala-scala/src/library/scala/collection/Seq.scala
exception occurred while compiling ./scala-scala/src/library/scala/Option.scala, ./scala-scala/src/library/scala/collection/Seq.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: data race? overwriting symbol of scala.collection.Seq / TypeRef(ThisType(TypeRef(NoPrefix,collection)),Seq) / class dotty.tools.dotc.core.Types$CachedTypeRef / 2918 / 4702 / module class collection / module class collection / frontend at run 2
        at scala.Predef$.assert(Predef.scala:165)
        at dotty.tools.dotc.core.Types$NamedType.checkSymAssign(Types.scala:1379)
        at dotty.tools.dotc.core.Types$NamedType.setDenot(Types.scala:1407)
        at dotty.tools.dotc.core.Types$NamedType.withDenot(Types.scala:1400)
        at dotty.tools.dotc.core.Types$TypeRef$.apply(Types.scala:1794)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.typeRef(SymDenotations.scala:1051)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.typeRef(SymDenotations.scala:1297)
        at dotty.tools.dotc.core.Symbols$$anonfun$synthesizeCompanionMethod$1.apply(Symbols.scala:188)
        at dotty.tools.dotc.core.Symbols$$anonfun$synthesizeCompanionMethod$1.apply(Symbols.scala:188)
        at dotty.tools.dotc.core.Symbols$Symbol.orElse(Symbols.scala:450)
        at dotty.tools.dotc.core.Symbols$class.synthesizeCompanionMethod(Symbols.scala:187)
        at dotty.tools.dotc.core.Contexts$Context.synthesizeCompanionMethod(Contexts.scala:53)
        at dotty.tools.dotc.typer.Namer.dotty$tools$dotc$typer$Namer$$createLinks$1(Namer.scala:458)
        at dotty.tools.dotc.typer.Namer$$anonfun$createCompanionLinks$1$2.apply(Namer.scala:466)
        at dotty.tools.dotc.typer.Namer$$anonfun$createCompanionLinks$1$2.apply(Namer.scala:463)
        at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:778)
        at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:108)
        at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:108)
        at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230)
        at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
        at scala.collection.mutable.HashMap$$anon$2.foreach(HashMap.scala:108)
        at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:777)
        at dotty.tools.dotc.typer.Namer.createCompanionLinks$1(Namer.scala:463)
        at dotty.tools.dotc.typer.Namer.index(Namer.scala:475)
        at dotty.tools.dotc.typer.Namer.indexExpanded(Namer.scala:401)
        at dotty.tools.dotc.typer.Namer$$anonfun$6.apply(Namer.scala:474)
        at dotty.tools.dotc.typer.Namer$$anonfun$6.apply(Namer.scala:474)
        at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
        at scala.collection.immutable.List.foldLeft(List.scala:84)
        at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:136)
        at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:104)
        at dotty.tools.dotc.typer.Namer.index(Namer.scala:474)
        at dotty.tools.dotc.typer.Namer.indexExpanded(Namer.scala:401)
        at dotty.tools.dotc.typer.Namer.index(Namer.scala:392)
        at dotty.tools.dotc.typer.FrontEnd$$anonfun$enterSyms$1.apply$mcV$sp(FrontEnd.scala:41)
        at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:23)
        at dotty.tools.dotc.typer.FrontEnd.enterSyms(FrontEnd.scala:39)
        at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$2.apply(FrontEnd.scala:68)
        at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$2.apply(FrontEnd.scala:68)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:68)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:60)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:57)
        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:57)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
        at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:52)
        at dotty.tools.dotc.Run.compileSources(Run.scala:49)
        at dotty.tools.dotc.Run.compile(Run.scala:33)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:21)
        at dotty.tools.dotc.Driver.process(Driver.scala:44)
        at dotty.tools.dotc.Driver.process(Driver.scala:50)
        at dotty.tools.dotc.Driver.main(Driver.scala:58)
        at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions