Skip to content

Commit a688933

Browse files
committed
Adjust member.info (removing This) instead of changing self
1 parent 17217b5 commit a688933

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

+8-5
Original file line numberDiff line numberDiff line change
@@ -1837,11 +1837,14 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
18371837
def termSymbol: Symbol = self.termSymbol
18381838
def isSingleton: Boolean = self.isSingleton
18391839
def memberType(member: Symbol): TypeRepr =
1840-
// we use thisType to avoid resolving otherwise unstable prefixes into Nothing
1841-
val classSymbol = self.classSymbol
1842-
member.info
1843-
.asSeenFrom(classSymbol.thisType, member.owner)
1844-
.substThis(classSymbol.asClass, self) // and we remove the previously added This(_) for compatibility
1840+
// we replace thisTypes here to avoid resolving otherwise unstable prefixes into Nothing
1841+
val selfInfo =
1842+
if self.typeSymbol.isClassDef then
1843+
member.info.substThis(self.classSymbol.asClass, self)
1844+
else
1845+
member.info
1846+
selfInfo
1847+
.asSeenFrom(self, member.owner)
18451848

18461849
def baseClasses: List[Symbol] = self.baseClasses
18471850
def baseType(cls: Symbol): TypeRepr = self.baseType(cls)

0 commit comments

Comments
 (0)