Skip to content

Commit 959064f

Browse files
committed
Reflect AbsOverride as Abstract | Override
This is the encoding used in the pickled TASTy.
1 parent 09cf574 commit 959064f

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,13 +2487,13 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
24872487
newMethod(owner, name, tpe, Flags.EmptyFlags, noSymbol)
24882488
def newMethod(owner: Symbol, name: String, tpe: TypeRepr, flags: Flags, privateWithin: Symbol): Symbol =
24892489
checkValidFlags(flags.toTermFlags, Flags.validMethodFlags)
2490-
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags | dotc.core.Flags.Method, tpe, privateWithin)
2490+
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags.toInternalFlags | dotc.core.Flags.Method, tpe, privateWithin)
24912491
def newVal(owner: Symbol, name: String, tpe: TypeRepr, flags: Flags, privateWithin: Symbol): Symbol =
24922492
checkValidFlags(flags.toTermFlags, Flags.validValFlags)
2493-
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags, tpe, privateWithin)
2493+
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags.toInternalFlags, tpe, privateWithin)
24942494
def newBind(owner: Symbol, name: String, flags: Flags, tpe: TypeRepr): Symbol =
24952495
checkValidFlags(flags.toTermFlags, Flags.validBindFlags)
2496-
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags | dotc.core.Flags.Case, tpe)
2496+
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags.toInternalFlags | dotc.core.Flags.Case, tpe)
24972497
def noSymbol: Symbol = dotc.core.Symbols.NoSymbol
24982498

24992499
private inline def checkValidFlags(inline flags: Flags, inline valid: Flags): Unit =
@@ -2510,7 +2510,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
25102510
extension (self: Symbol)
25112511
def owner: Symbol = self.denot.owner
25122512
def maybeOwner: Symbol = self.denot.maybeOwner
2513-
def flags: Flags = self.denot.flags
2513+
def flags: Flags = self.denot.flags.toExternalFlags
25142514

25152515
def privateWithin: Option[TypeRepr] =
25162516
val within: Symbol =
@@ -2764,7 +2764,6 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
27642764

27652765
object Flags extends FlagsModule:
27662766
def Abstract: Flags = dotc.core.Flags.Abstract
2767-
def AbsOverride: Flags = dotc.core.Flags.AbsOverride
27682767
def Artifact: Flags = dotc.core.Flags.Artifact
27692768
def Case: Flags = dotc.core.Flags.Case
27702769
def CaseAccessor: Flags = dotc.core.Flags.CaseAccessor
@@ -2811,8 +2810,8 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
28112810
def Trait: Flags = dotc.core.Flags.Trait
28122811
def Transparent: Flags = dotc.core.Flags.Transparent
28132812

2814-
private[QuotesImpl] def validMethodFlags: Flags = Private | Protected | Override | Deferred | Final | Method | Implicit | Given | Local | JavaStatic | AbsOverride // Synthetic | ExtensionMethod | Exported | Erased | Infix | Invisible
2815-
private[QuotesImpl] def validValFlags: Flags = Private | Protected | Override | Deferred | Final | Param | Implicit | Lazy | Mutable | Local | ParamAccessor | Module | Package | Case | CaseAccessor | Given | Enum | JavaStatic | AbsOverride // Synthetic | Erased | Invisible
2813+
private[QuotesImpl] def validMethodFlags: Flags = Private | Protected | Override | Deferred | Final | Method | Implicit | Given | Local | JavaStatic // Synthetic | ExtensionMethod | Exported | Erased | Infix | Invisible
2814+
private[QuotesImpl] def validValFlags: Flags = Private | Protected | Override | Deferred | Final | Param | Implicit | Lazy | Mutable | Local | ParamAccessor | Module | Package | Case | CaseAccessor | Given | Enum | JavaStatic // Synthetic | Erased | Invisible
28162815
private[QuotesImpl] def validBindFlags: Flags = Case // | Implicit | Given | Erased
28172816
end Flags
28182817

@@ -2822,6 +2821,16 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
28222821
def |(that: Flags): Flags = dotc.core.Flags.or(self, that) // TODO: Replace with dotc.core.Flags.|(self)(that) once extension names have stabilized
28232822
def &(that: Flags): Flags = dotc.core.Flags.and(self, that)// TODO: Replace with dotc.core.Flags.&(self)(that) once extension names have stabilized
28242823
def show: String = Extractors.showFlags(using QuotesImpl.this)(self)
2824+
2825+
private[QuotesImpl] inline def toInternalFlags: Flags =
2826+
if self.isAllOf(dotc.core.Flags.AbstractOverride) then
2827+
self &~ dotc.core.Flags.AbstractOverride | dotc.core.Flags.AbsOverride
2828+
else self
2829+
2830+
private[QuotesImpl] inline def toExternalFlags: Flags =
2831+
if self.is(dotc.core.Flags.AbsOverride) then
2832+
self &~ dotc.core.Flags.AbsOverride | dotc.core.Flags.AbstractOverride
2833+
else self
28252834
end extension
28262835
end FlagsMethods
28272836

library/src/scala/quoted/Quotes.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4229,18 +4229,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
42294229
/** Is this symbol `abstract` */
42304230
def Abstract: Flags
42314231

4232-
/** Is this symbol is labeled with of abstract & override
4233-
*
4234-
* The override modifier has an additional significance when combined with the abstract modifier.
4235-
* That modifier combination is only allowed for value members of traits.
4236-
*
4237-
* We call a member MM of a template incomplete if it is either abstract (i.e. defined by a declaration), or it is labeled abstract and override and every member overridden by MM is again incomplete.
4238-
*
4239-
* Note that the abstract override modifier combination does not influence the concept whether a member is concrete or abstract.
4240-
* A member is abstract if only a declaration is given for it; it is concrete if a full definition is given.
4241-
*/
4242-
@experimental def AbsOverride: Flags
4243-
42444232
/** Is this generated by Scala compiler.
42454233
* Corresponds to ACC_SYNTHETIC in the JVM.
42464234
*/

tests/run-custom-args/tasty-inspector/stdlibExperimentalDefinitions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ val experimentalDefinitionInLibrary = Set(
7676
"scala.quoted.Quotes.reflectModule.SymbolModule.newClass",
7777
"scala.quoted.Quotes.reflectModule.SymbolModule.freshName",
7878
"scala.quoted.Quotes.reflectModule.SymbolMethods.info",
79-
"scala.quoted.Quotes.reflectModule.FlagsModule.AbsOverride",
8079

8180
// New APIs: Lightweight lazy vals. Can be stabilized in 3.3.0
8281
"scala.runtime.LazyVals$.Evaluating",

0 commit comments

Comments
 (0)