Closed alexishorner closed 5 months ago
Hi ! I am rewriting the ExtractAPI phase of dotty using TASTy Query and I need to query if a Symbol has the override modifier.
ExtractAPI
Symbol
override
Here is what the original dotty source code looks like (available in full here):
def apiModifiers(sym: Symbol): api.Modifiers = { val absOver = sym.is(AbsOverride) val abs = absOver || sym.isOneOf(Trait | Abstract | Deferred) val over = absOver || sym.is(Override) new api.Modifiers(abs, over, [...]) }
My current solution boils down to doing
sym.flags.is(Override)
However, Symbol.flags is protected, so I invoke it using reflection, which does not seem like a great solution.
Symbol.flags
protected
Does someone know a better way of checking if a Symbol has the override modifier ? Thanks in advance for your assistance !
advice from @sjrd - (in the context of incremental compilation) ignore the override flag altogether - its not information that could ever require a downstream recompilation
Got it, thanks !
Hi ! I am rewriting the
ExtractAPI
phase of dotty using TASTy Query and I need to query if aSymbol
has theoverride
modifier.Here is what the original dotty source code looks like (available in full here):
My current solution boils down to doing
However,
Symbol.flags
isprotected
, so I invoke it using reflection, which does not seem like a great solution.Does someone know a better way of checking if a
Symbol
has theoverride
modifier ? Thanks in advance for your assistance !