@@ -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
@@ -2823,7 +2824,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2823
2824
modFlags | dotc.core.Flags .ModuleValCreationFlags ,
2824
2825
clsFlags | dotc.core.Flags .ModuleClassCreationFlags ,
2825
2826
parents,
2826
- dotc.core. Scopes . newScope,
2827
+ newScope,
2827
2828
privateWithin,
2828
2829
NoCoord ,
2829
2830
compUnitInfo = null
@@ -2839,7 +2840,9 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2839
2840
xCheckMacroAssert(! privateWithin.exists || privateWithin.isType, " privateWithin must be a type symbol or `Symbol.noSymbol`" )
2840
2841
val privateWithin1 = if privateWithin.isTerm then Symbol .noSymbol else privateWithin
2841
2842
checkValidFlags(flags.toTermFlags, Flags .validMethodFlags)
2842
- dotc.core.Symbols .newSymbol(owner, name.toTermName, flags | dotc.core.Flags .Method , tpe, privateWithin1)
2843
+ val method = dotc.core.Symbols .newSymbol(owner, name.toTermName, flags | dotc.core.Flags .Method , tpe, privateWithin1)
2844
+ method.setParamss(method.paramSymss)
2845
+ method
2843
2846
def newVal (owner : Symbol , name : String , tpe : TypeRepr , flags : Flags , privateWithin : Symbol ): Symbol =
2844
2847
xCheckMacroAssert(! privateWithin.exists || privateWithin.isType, " privateWithin must be a type symbol or `Symbol.noSymbol`" )
2845
2848
val privateWithin1 = if privateWithin.isTerm then Symbol .noSymbol else privateWithin
@@ -3066,7 +3069,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
3066
3069
3067
3070
def asQuotes : Nested =
3068
3071
assert(self.ownersIterator.contains(ctx.owner), s " $self is not owned by ${ctx.owner}" )
3069
- new QuotesImpl (using ctx.withOwner(self))
3072
+ val newCtx = if ctx.owner eq self then ctx else
3073
+ val newCtx = ctx.fresh.setOwner(self)
3074
+ if ! self.flags.is(Flags .Method ) then newCtx
3075
+ else newCtx.setScope(newScopeWith(self.paramSymss.flatten* ))
3076
+ new QuotesImpl (using newCtx)
3070
3077
3071
3078
end extension
3072
3079
0 commit comments