Skip to content

Commit d6d898f

Browse files
pikinier20nicolasstucki
authored andcommitted
Add Symbol.isSuperAccessor to reflection API
1 parent f8b869b commit d6d898f

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-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
@@ -2513,6 +2513,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
25132513
def isAnonymousFunction: Boolean = self.denot.isAnonymousFunction
25142514
def isAbstractType: Boolean = self.denot.isAbstractType
25152515
def isClassConstructor: Boolean = self.denot.isClassConstructor
2516+
def isSuperAccessor = self.name.is(dotc.core.NameKinds.SuperAccessorName)
25162517
def isType: Boolean = self.isType
25172518
def isTerm: Boolean = self.isTerm
25182519
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
@@ -3645,6 +3645,10 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
36453645
/** Is this the constructor of a class? */
36463646
def isClassConstructor: Boolean
36473647

3648+
/** Is this the super accessor? */
3649+
@experimental // TODO when stable, remove `dotty.tools.scaladoc.tasty.ClassLikeSupport.isSuperBridgeMethod` and use this method
3650+
def isSuperAccessor: Boolean
3651+
36483652
/** Is this the definition of a type? */
36493653
def isType: Boolean
36503654

project/MiMaFilters.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ import com.typesafe.tools.mima.core.ProblemFilters._
44

55
object MiMaFilters {
66
val Library: Seq[ProblemFilter] = Seq(
7+
// New APIs that will be introduced in 3.2.0
8+
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SymbolMethods.isSuperAccessor"),
79
)
810
}

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

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

24+
// TODO remove and use `SymbolMethods.isSuperAccessor`
2425
def isSuperBridgeMethod: Boolean = s.name.contains("$super$")
2526

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

0 commit comments

Comments
 (0)