@@ -11,6 +11,7 @@ import dotty.tools.dotc.core.Contexts.*
11
11
import dotty .tools .dotc .core .Decorators .*
12
12
import dotty .tools .dotc .core .NameKinds
13
13
import dotty .tools .dotc .core .NameOps .*
14
+ import dotty .tools .dotc .core .Scopes .*
14
15
import dotty .tools .dotc .core .StdNames .*
15
16
import dotty .tools .dotc .core .Types
16
17
import dotty .tools .dotc .NoCompilationUnit
@@ -2579,7 +2580,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2579
2580
modFlags | dotc.core.Flags .ModuleValCreationFlags ,
2580
2581
clsFlags | dotc.core.Flags .ModuleClassCreationFlags ,
2581
2582
parents,
2582
- dotc.core. Scopes . newScope,
2583
+ newScope,
2583
2584
privateWithin)
2584
2585
val cls = mod.moduleClass.asClass
2585
2586
cls.enter(dotc.core.Symbols .newConstructor(cls, dotc.core.Flags .Synthetic , Nil , Nil ))
@@ -2592,7 +2593,9 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2592
2593
xCheckMacroAssert(! privateWithin.exists || privateWithin.isType, " privateWithin must be a type symbol or `Symbol.noSymbol`" )
2593
2594
val privateWithin1 = if privateWithin.isTerm then Symbol .noSymbol else privateWithin
2594
2595
checkValidFlags(flags.toTermFlags, Flags .validMethodFlags)
2595
- dotc.core.Symbols .newSymbol(owner, name.toTermName, flags | dotc.core.Flags .Method , tpe, privateWithin1)
2596
+ val method = dotc.core.Symbols .newSymbol(owner, name.toTermName, flags | dotc.core.Flags .Method , tpe, privateWithin1)
2597
+ method.setParamss(method.paramSymss)
2598
+ method
2596
2599
def newVal (owner : Symbol , name : String , tpe : TypeRepr , flags : Flags , privateWithin : Symbol ): Symbol =
2597
2600
xCheckMacroAssert(! privateWithin.exists || privateWithin.isType, " privateWithin must be a type symbol or `Symbol.noSymbol`" )
2598
2601
val privateWithin1 = if privateWithin.isTerm then Symbol .noSymbol else privateWithin
@@ -2807,7 +2810,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2807
2810
2808
2811
def asQuotes : Nested =
2809
2812
assert(self.ownersIterator.contains(ctx.owner), s " $self is not owned by ${ctx.owner}" )
2810
- new QuotesImpl (using ctx.withOwner(self))
2813
+ val newCtx = if ctx.owner eq self then ctx else
2814
+ val newCtx = ctx.fresh.setOwner(self)
2815
+ if ! self.flags.is(Flags .Method ) then newCtx
2816
+ else newCtx.setScope(newScopeWith(self.paramSymss.flatten* ))
2817
+ new QuotesImpl (using newCtx)
2811
2818
2812
2819
end extension
2813
2820
0 commit comments