Skip to content

Commit b199c8d

Browse files
committed
Add Symbol.isSuperAccessor to reflection API
1 parent 4e41a4c commit b199c8d

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,6 +2548,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
25482548
def isAnonymousFunction: Boolean = self.denot.isAnonymousFunction
25492549
def isAbstractType: Boolean = self.denot.isAbstractType
25502550
def isClassConstructor: Boolean = self.denot.isClassConstructor
2551+
def isSuperAccessor = self.name.is(dotc.core.NameKinds.SuperAccessorName)
25512552
def isType: Boolean = self.isType
25522553
def isTerm: Boolean = self.isTerm
25532554
def isPackageDef: Boolean = self.is(dotc.core.Flags.Package)

library/src/scala/quoted/Quotes.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,6 +3806,10 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
38063806
/** Is this the constructor of a class? */
38073807
def isClassConstructor: Boolean
38083808

3809+
/** Is this the super accessor? */
3810+
@experimental // TODO when stable, remove `dotty.tools.scaladoc.tasty.ClassLikeSupport.isSuperBridgeMethod` and use this method
3811+
def isSuperAccessor: Boolean
3812+
38093813
/** Is this the definition of a type? */
38103814
def isType: Boolean
38113815

scaladoc/src/dotty/tools/scaladoc/tasty/SyntheticSupport.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ object SyntheticsSupport:
1010
import reflect._
1111
s.flags.is(Flags.Synthetic) || s.flags.is(Flags.FieldAccessor) || s.isDefaultHelperMethod
1212

13+
// TODO remove and use `SymbolMethods.isSuperAccessor`
1314
def isSuperBridgeMethod: Boolean = s.name.contains("$super$")
1415

1516
def isDefaultHelperMethod: Boolean = ".*\\$default\\$\\d+$".r.matches(s.name)

0 commit comments

Comments
 (0)