-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Closed
Copy link
Labels
itype:bugitype:crashregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymorestat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Milestone
Description
Compiler version
3.nightly, available in current main, but not in 3.6.0-RC1-bin-20240807-54344a1-NIGHTLY (last available, last night build failed)
Caused by 8a41389 introduced in #21339, reverted during backport to 3.5.0
Unhandled exception is thrown during inlining
or when using -Yforce-sbt-phases
in sbt-api
Minimized code
// schema.scala
//> using options -source:3.5
case class Schema[T](format: String):
def asOption: Schema[Option[T]] = ???
def name(name: Option[SName]): Schema[T] = ???
def format(f: String): Schema[T] = ???
object Schema extends SchemaCompanionMacros:
implicit def schemaForOption[T: Schema]: Schema[Option[T]] =
implicitly[Schema[T]]
???
trait SchemaCompanionMacros extends SchemaDerivation:
given derivedStringBasedUnionEnumeration[S](using IsUnionOf[String, S]): Schema[S] =
val x: Schema[S] = ???
x.name(None)
@main def Test =
case class Foo(x: Int) derives Schema
// schemaDerivation.scala
import scala.deriving.*
import scala.quoted.*
trait SName
abstract class CaseClass[Typeclass[_], Type]:
def param: CaseClass.Param[Typeclass, Type]
object CaseClass:
trait Param[Typeclass[_], Type]:
type PType
def typeclass: Typeclass[PType]
sealed trait IsUnionOf[T, A]
object IsUnionOf:
transparent inline given derived[T, A]: IsUnionOf[T, A] = ${ deriveImpl[T, A] }
private def deriveImpl[T, A](using quotes: Quotes): Expr[IsUnionOf[T, A]] = ???
trait SchemaDerivation:
inline implicit def derived[T](implicit m: Mirror.Of[T]): Schema[T] =
val ctx: CaseClass[Schema, T] = ???
val valueSchema = ctx.param.typeclass
val format = valueSchema.format
???
Output (click arrow to expand)
unhandled exception while running inlining on /Users/wmazur/projects/sandbox/src/main/scala/schema.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/src/main/scala/schema.scala
during phase: inlining
mode: Mode(ImplicitsEnabled)
library version: version 2.13.14
compiler version: version 3.5.0-RC6-bin-73c6e88-SNAPSHOT-git-73c6e88
settings: -classpath /Users/wmazur/Library/Caches/Coursier/v1/https/scala3.westeurope.cloudapp.azure.com/maven2/3.5.0-RC6-bin-73c6e88-SNAPSHOT/org/scala-lang/scala3-library_3/3.5.0-RC6-bin-73c6e88-SNAPSHOT/scala3-library_3-3.5.0-RC6-bin-73c6e88-SNAPSHOT.jar:/Users/wmazur/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar -d /Users/wmazur/projects/sandbox/src/.scala-build/src_851f5ccd4f/classes/main -java-output-version 17 -sourceroot /Users/wmazur/projects/sandbox/src
Exception while compiling /Users/wmazur/projects/sandbox/src/main/scala/schema.scala, /Users/wmazur/projects/sandbox/src/main/scala/schemaDerivation.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: <no file>
during phase: parser
mode: Mode()
library version: version 2.13.14
compiler version: version 3.5.0-RC6-bin-73c6e88-SNAPSHOT-git-73c6e88
settings: -classpath /Users/wmazur/Library/Caches/Coursier/v1/https/scala3.westeurope.cloudapp.azure.com/maven2/3.5.0-RC6-bin-73c6e88-SNAPSHOT/org/scala-lang/scala3-library_3/3.5.0-RC6-bin-73c6e88-SNAPSHOT/scala3-library_3-3.5.0-RC6-bin-73c6e88-SNAPSHOT.jar:/Users/wmazur/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar -d /Users/wmazur/projects/sandbox/src/.scala-build/src_851f5ccd4f/classes/main -java-output-version 17 -sourceroot /Users/wmazur/projects/sandbox/src
Exception in thread "main" dotty.tools.dotc.core.Denotations$StaleSymbolException: stale symbol; val format#4134 in class Schema, defined in Period(2.1-53), is referred to in run Period(3.12)
at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:961)
at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:759)
at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:806)
at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:877)
at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:124)
at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:118)
at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
at dotty.tools.dotc.core.Symbols$.toDenot(Symbols.scala:544)
at dotty.tools.dotc.core.SourceLanguage$.apply(TypeErasure.scala:27)
at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:613)
at dotty.tools.dotc.core.Types$NamedType.sigFromDenot(Types.scala:2435)
at dotty.tools.dotc.core.Types$NamedType.currentSignature(Types.scala:2426)
at dotty.tools.dotc.core.Types$NamedType.disambiguate(Types.scala:2552)
at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:2575)
at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:2543)
at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:2502)
at dotty.tools.dotc.core.Types$NamedType.computeSymbol(Types.scala:2449)
at dotty.tools.dotc.core.Types$NamedType.symbol(Types.scala:2444)
at dotty.tools.dotc.core.Types$Type.termSymbol(Types.scala:665)
at dotty.tools.dotc.inlines.Inliner$$anon$4.apply(Inliner.scala:569)
at dotty.tools.dotc.inlines.Inliner$$anon$4.apply(Inliner.scala:565)
at dotty.tools.dotc.ast.TreeTypeMap.mapType(TreeTypeMap.scala:72)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:105)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1597)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:151)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1640)
at scala.collection.immutable.List.mapConserve(List.scala:473)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1640)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformSub(Trees.scala:1644)
at dotty.tools.dotc.ast.TreeTypeMap.transformDefs(TreeTypeMap.scala:160)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:120)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1542)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:151)
at dotty.tools.dotc.inlines.Inliner.inlined(Inliner.scala:623)
at dotty.tools.dotc.inlines.Inlines$InlineCall.expand(Inlines.scala:491)
at dotty.tools.dotc.inlines.Inlines$.inlineCall(Inlines.scala:163)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:100)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1597)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:67)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:63)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transformMemberDef(Inlining.scala:141)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:77)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1242)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:58)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:63)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:101)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1602)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:67)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:60)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transformMemberDef(Inlining.scala:141)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:77)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformBlock(tpd.scala:1245)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1548)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:43)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:54)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:79)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:50)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:63)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transformMemberDef(Inlining.scala:141)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:77)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1242)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:58)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:63)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:101)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1602)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:67)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:60)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transformMemberDef(Inlining.scala:141)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:77)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1240)
at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1242)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1613)
at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:67)
at dotty.tools.dotc.ast.TreeMapWithTrackedStats.transform(TreeMapWithTrackedStats.scala:48)
at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:81)
at dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:63)
at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:20)
at dotty.tools.dotc.transform.Inlining.run(Inlining.scala:39)
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.Inlining.runOn(Inlining.scala:43)
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.compileUnits(Run.scala:288)
at dotty.tools.dotc.Run.compileSuspendedUnits(Run.scala:410)
at dotty.tools.dotc.Driver.finish(Driver.scala:63)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
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)
Compilation failed
Metadata
Metadata
Assignees
Labels
itype:bugitype:crashregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymorestat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label