Open WojciechMazur opened 1 month ago
@Gedochao Do you mind if I reassign this to myself? (@jchyb is away right now anyway)
Plus this seems unrelated to metaprogramming to me. It seems to me that the only thing the macro expansion changes is incrementing the runId
for the usage file. Also, the affecting PR is this one: https://github.com/scala/scala3/pull/19786, specifically the recomputeDenot
change
Also', here is a smaller minimization:
// Macro.scala
import scala.quoted.*
trait Schema
object Schema:
lazy val sampleDate: String = "" // lazy val requried to reproduce
inline def derived: Schema =
annotations
new Schema {}
inline def annotations: Int = ${ annotationsImpl }
def annotationsImpl(using Quotes): Expr[Int] = Expr(1)
// Test.scala
//> using scala 3.nightly
val inputValueSchema = Schema.derived
Output:
When a macro definition and call are located in the same compilation run, the compiler suspends the macro call compilation unit, finishes compiling other stuff and comes back to the macro later. Some parts of the context and symbol denotations can be shared between those runs which can cause those stale symbol issues. I believe there is might be a pass refreshing denotations somewhere in typer for exactly that occasion, but I still don't quite understand everything there. With that said please feel free to try taking this on if you want @KacperFKorban, especially since you have a lead. I find those stale symbol errors very difficult personally, so any help is appreciated
Similar to #20323 but this one is a regression introduced in 3.4.2 Based on OpenCB failure in
shopstic/caliban
- logsCompiler version
Last good release: 3.4.2-RC1-bin-20240222-98efdab-NIGHTLY First bad release: 3.4.2-RC1-bin-20240226-e0cb1e7-NIGHTLY
Bisect points to 5a884bc3f8501e0bdf9ce35eb633147105d5a4f6 but compiler build deadlocked in a few revisions that were skipped, though it might not be accurate Can be any of changes between 98efdab..e0cb1e7
Minimized code
Output (click arrow to expand)