Skip to content

StackOverflowError during pickleQuotes with type parameter T <: SomeTrait[T] #22996

@mrdziuban

Description

@mrdziuban

Compiler version

3.3.5, 3.4.3, 3.5.2, 3.6.4, and latest nightly 3.7.1-RC1-bin-20250413-5b4b5c2-NIGHTLY

Minimized code

import scala.quoted.* trait Appendable[T] trait Format[T <: Appendable[T]] { def empty: T } object FormatMacros { def test[T <: Appendable[T]: Type, F <: Format[T]: Type](f: Expr[F])(using Quotes): Expr[T] = '{ $f.empty } }

Output (click arrow to expand)

Full output (too long for an issue description): https://gist.github.com/mrdziuban/72dd9e63263a816912a5476409453c57

If I remove the <: Appendable[T] constraint from type parameter T then there's no error.

 unhandled exception while running pickleQuotes on /Users/matt/twirl-macro-test/src/main/scala/example/Test.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/matt/twirl-macro-test/src/main/scala/example/Test.scala during phase: pickleQuotes mode: Mode(ImplicitsEnabled) library version: version 2.13.16 compiler version: version 3.7.1-RC1-bin-20250413-5b4b5c2-NIGHTLY-git-5b4b5c2 settings: -classpath /Users/matt/twirl-macro-test/target/scala-3.7.1-RC1-bin-20250413-5b4b5c2-NIGHTLY/classes:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.7.1-RC1-bin-20250413-5b4b5c2-NIGHTLY/scala3-library_3-3.7.1-RC1-bin-20250413-5b4b5c2-NIGHTLY.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.16/scala-library-2.13.16.jar -d /Users/matt/twirl-macro-test/target/scala-3.7.1-RC1-bin-20250413-5b4b5c2-NIGHTLY/classes ## Exception when compiling 1 sources to /Users/matt/twirl-macro-test/target/scala-3.7.1-RC1-bin-20250413-5b4b5c2-NIGHTLY/classes java.lang.StackOverflowError dotty.tools.dotc.core.TypeOps$AvoidMap.apply(TypeOps.scala:497) dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:6297) dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:3178) dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:6296) dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:3178) dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:6296) dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:3178) dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:6296) dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:3178) dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:321) dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:183) dotty.tools.dotc.core.tasty.TreePickler.pickleNewType$$anonfun$2(TreePickler.scala:204) scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) scala.collection.immutable.List.foreach(List.scala:334) // the following lines are then repeated 126 times dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:204) dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:183) dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:321) dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:183) dotty.tools.dotc.core.tasty.TreePickler.pickleNewType$$anonfun$2(TreePickler.scala:204) scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) scala.collection.immutable.List.foreach(List.scala:334) dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:204) // ...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions