Skip to content
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

Crash in pickler when self type is intersection type #21853

Closed
WojciechMazur opened this issue Oct 29, 2024 · 3 comments
Closed

Crash in pickler when self type is intersection type #21853

WojciechMazur opened this issue Oct 29, 2024 · 3 comments
Labels
area:pickling itype:bug itype:crash regression This worked in a previous version but doesn't anymore stat:duplicate

Comments

@WojciechMazur
Copy link
Contributor

WojciechMazur commented Oct 29, 2024

Based on OpenCB failure in scala-graph/scala-graph

Compiler version

Last good release: 3.3.1-RC1-bin-20230215-006e2e4-NIGHTLY
First bad release: 3.3.1-RC1-bin-20230216-2507577-NIGHTLY

Bisect points to 8d65f19

Minimized code

trait GraphTraversal:
  type NodeT
  trait Properties:
    def root: NodeT

  trait TraverserMethods[A, +CC <: TraverserMethods[A, CC]]:
    self: CC & Properties =>
      def root: NodeT

Output (click arrow to expand)

error when pickling tree def root: GraphTraversal.this.NodeT of class class dotty.tools.dotc.ast.Trees$DefDef
error when pickling tree [A >: Nothing <: Any, CC >: Nothing <: GraphTraversal.this.TraverserMethods[A, CC]]() extends Object { self: TraverserMethods.this.CC & GraphTraversal.this.Properties =>
  A
  +CC <: GraphTraversal.this.TraverserMethods[A, CC]
  def root: GraphTraversal.this.NodeT
} of class class dotty.tools.dotc.ast.Trees$Template
error when pickling tree trait TraverserMethods[A >: Nothing <: Any, CC >: Nothing <: GraphTraversal.this.TraverserMethods[A, CC]]() extends Object {
  self: TraverserMethods.this.CC & GraphTraversal.this.Properties =>
  A
  +CC <: GraphTraversal.this.TraverserMethods[A, CC]
  def root: GraphTraversal.this.NodeT
} of class class dotty.tools.dotc.ast.Trees$TypeDef
error when pickling tree () extends Object {
  type NodeT >: Nothing <: Any
  trait Properties() extends Object {
    def root: GraphTraversal.this.NodeT
  }
  trait TraverserMethods[A >: Nothing <: Any, CC >: Nothing <: GraphTraversal.this.TraverserMethods[A, CC]]() extends Object {
    self: TraverserMethods.this.CC & GraphTraversal.this.Properties =>
    A
    +CC <: GraphTraversal.this.TraverserMethods[A, CC]
    def root: GraphTraversal.this.NodeT
  }
} of class class dotty.tools.dotc.ast.Trees$Template
error when pickling tree @SourceFile("graphTraversal.scala") trait GraphTraversal() extends Object {
  type NodeT >: Nothing <: Any
  trait Properties() extends Object {
    def root: GraphTraversal.this.NodeT
  }
  trait TraverserMethods[A >: Nothing <: Any, CC >: Nothing <: GraphTraversal.this.TraverserMethods[A, CC]]() extends Object {
    self: TraverserMethods.this.CC & GraphTraversal.this.Properties =>
    A
    +CC <: GraphTraversal.this.TraverserMethods[A, CC]
    def root: GraphTraversal.this.NodeT
  }
} of class class dotty.tools.dotc.ast.Trees$TypeDef
error when pickling tree package <empty> {
  @SourceFile("graphTraversal.scala") trait GraphTraversal() extends Object {
    type NodeT >: Nothing <: Any
    trait Properties() extends Object {
      def root: GraphTraversal.this.NodeT
    }
    trait TraverserMethods[A >: Nothing <: Any, CC >: Nothing <: GraphTraversal.this.TraverserMethods[A, CC]]() extends Object {
      self: TraverserMethods.this.CC & GraphTraversal.this.Properties =>
      A
      +CC <: GraphTraversal.this.TraverserMethods[A, CC]
      def root: GraphTraversal.this.NodeT
    }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef

  unhandled exception while running pickler on /Users/wmazur/projects/sandbox/graphTraversal.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.

     while compiling: /Users/wmazur/projects/sandbox/graphTraversal.scala
        during phase: pickler
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.15
    compiler version: version 3.6.1
            settings: -classpath /Users/wmazur/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.6.1/scala3-library_3-3.6.1.jar:/Users/wmazur/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.15/scala-library-2.13.15.jar -d /Users/wmazur/projects/sandbox/.scala-build/sandbox_755cda591f-33703b4d14/classes/main -java-output-version 17 -sourceroot /Users/wmazur/projects/sandbox

Exception in thread "main" java.lang.AssertionError: assertion failed: method root
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:372)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:662)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:423)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:334)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:423)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:698)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:381)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:664)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:423)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:334)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:423)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:698)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:381)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:664)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:423)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:334)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats(TreePickler.scala:423)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:714)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle$$anonfun$1(TreePickler.scala:938)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:334)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:936)
        at dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:306)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:334)
        at dotty.tools.dotc.transform.Pickler.run$$anonfun$1(Pickler.scala:279)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:334)
        at dotty.tools.dotc.transform.Pickler.run(Pickler.scala:278)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:380)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:334)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:373)
        at dotty.tools.dotc.transform.Pickler.runPhase$1(Pickler.scala:392)
        at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:398)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:396)
        at dotty.tools.dotc.Run.compileSources(Run.scala:282)
        at dotty.tools.dotc.Run.compile(Run.scala:267)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.dotc.Driver.process(Driver.scala:201)
        at dotty.tools.dotc.Driver.process(Driver.scala:169)
        at dotty.tools.dotc.Driver.process(Driver.scala:181)
        at dotty.tools.dotc.Driver.main(Driver.scala:211)
        at dotty.tools.dotc.Main.main(Main.scala)
@WojciechMazur WojciechMazur added itype:bug area:pickling itype:crash regression This worked in a previous version but doesn't anymore labels Oct 29, 2024
@Gedochao
Copy link
Contributor

cc @odersky

@odersky
Copy link
Contributor

odersky commented Oct 29, 2024

Looks like a duplicate of #21755?

@Gedochao
Copy link
Contributor

Seems like it... got confused, the bisect points to a different commit (c830ad2 in #21755 and 8d65f19 here)...
But the repro is the same, and they're both from the same PR...

My bad, missed it.
Closing as duplicate.

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pickling itype:bug itype:crash regression This worked in a previous version but doesn't anymore stat:duplicate
Projects
None yet
Development

No branches or pull requests

4 participants