Merge pull request #8106 from eed3si9n/wip/repro-nested-macro2

[2.x] fix: Fix qual lookup
This commit is contained in:
eugene yokota 2025-05-05 03:29:03 -04:00 committed by GitHub
commit ff7dd1b76d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 1 deletions

View File

@ -266,7 +266,15 @@ trait Cont:
(name: String, tpe: Type[x], qual: Term, oldTree: Term) =>
given Type[x] = tpe
convert[x](name, qual) transform { (replacement: Term) =>
val idx = inputs.indexWhere(input => input.qual == qual)
val idxEq = inputs.indexWhere(input => input.qual == qual)
// use show to compare trees for Def.task comparison
val idx =
if idxEq < 0 then inputs.indexWhere(input => input.qual.show == qual.show)
else idxEq
if idx < 0 then
sys.error(
s"qual (${qual}) not found in ${inputs.map(_.qual)}"
)
applyTuple(p0, br.inputTupleTypeRepr, idx)
}
val modifiedBody =

View File

@ -0,0 +1,11 @@
lazy val a1 = settingKey[Boolean]("")
scalaVersion := "3.6.4"
a1 := true
Compile / sourceGenerators += {
val _ = a1.value
Def.task {
Seq.empty[File]
}.taskValue
}

View File

@ -0,0 +1 @@
> compile