Skip to content

Commit 8d3db3e

Browse files
committed
Merge SourceInvisible and Invisible flags
1 parent b6df544 commit 8d3db3e

File tree

11 files changed

+10
-24
lines changed

11 files changed

+10
-24
lines changed

compiler/src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ object Denotations {
10741074
def filterDisjoint(denots: PreDenotation)(using Context): SingleDenotation =
10751075
if (denots.exists && denots.matches(this)) NoDenotation else this
10761076
def filterWithFlags(required: FlagSet, excluded: FlagSet)(using Context): SingleDenotation =
1077-
val realExcluded = if ctx.isAfterTyper then excluded else excluded | Invisible | (if ctx.mode.is(Mode.ResolveFromTASTy) then EmptyFlags else SourceInvisible)
1077+
val realExcluded = if ctx.isAfterTyper then excluded else excluded | (if ctx.mode.is(Mode.ResolveFromTASTy) then EmptyFlags else Invisible)
10781078
def symd: SymDenotation = this match
10791079
case symd: SymDenotation => symd
10801080
case _ => symbol.denot

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,6 @@ object Flags {
380380
/** Tracked modifier for class parameter / a class with some tracked parameters */
381381
val (Tracked @ _, _, Dependent @ _) = newFlags(46, "tracked")
382382

383-
/** Symbol can not be resolved from source during typer. PROVISIONAL (possibly replace with `Invisible` with new semantics) */
384-
val (SourceInvisible @ _, _, _) = newFlags(47, "<source-invisible>")
385-
386383
// ------------ Flags following this one are not pickled ----------------------------------
387384

388385
/** Symbol is not a member of its owner */
@@ -474,7 +471,7 @@ object Flags {
474471
Scala2SpecialFlags, MutableOrOpen, Opaque, Touched, JavaStatic,
475472
OuterOrCovariant, LabelOrContravariant, CaseAccessor, Tracked,
476473
Extension, NonMember, Implicit, Given, Permanent, Synthetic, Exported,
477-
SuperParamAliasOrScala2x, Inline, Macro, ConstructorProxy, Invisible, SourceInvisible)
474+
SuperParamAliasOrScala2x, Inline, Macro, ConstructorProxy, Invisible)
478475

479476
/** Flags that are not (re)set when completing the denotation, or, if symbol is
480477
* a top-level class or object, when completing the denotation once the class
@@ -528,7 +525,7 @@ object Flags {
528525
val RetainedModuleValAndClassFlags: FlagSet =
529526
AccessFlags | Package | Case |
530527
Synthetic | JavaDefined | JavaStatic | Artifact |
531-
Lifted | MixedIn | Specialized | ConstructorProxy | Invisible | SourceInvisible | Erased
528+
Lifted | MixedIn | Specialized | ConstructorProxy | Invisible | Erased
532529

533530
/** Flags that can apply to a module val */
534531
val RetainedModuleValFlags: FlagSet = RetainedModuleValAndClassFlags |

compiler/src/dotty/tools/dotc/core/NamerOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ object NamerOps:
110110
else NoSymbol.assertingErrorsReported(em"no companion $name in $scope")
111111

112112
/** If a class has one of these flags, it does not get a constructor companion */
113-
private val NoConstructorProxyNeededFlags = Abstract | Trait | Case | Synthetic | Module | Invisible | SourceInvisible
113+
private val NoConstructorProxyNeededFlags = Abstract | Trait | Case | Synthetic | Module | Invisible
114114

115115
/** The flags of a constructor companion */
116116
private val ConstructorCompanionFlags = Synthetic | ConstructorProxy

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ object SymDenotations {
617617
case _ =>
618618
// Otherwise, no completion is necessary, see the preconditions of `markAbsent()`.
619619
(myInfo `eq` NoType)
620-
|| (is(Invisible) || is(SourceInvisible) && !ctx.mode.is(Mode.ResolveFromTASTy)) && ctx.isTyper
620+
|| (is(Invisible) && !ctx.mode.is(Mode.ResolveFromTASTy)) && ctx.isTyper
621621
|| is(ModuleVal, butNot = Package) && moduleClass.isAbsent(canForce)
622622
}
623623

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,6 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
881881
if flags.is(Transparent) then writeModTag(TRANSPARENT)
882882
if flags.is(Infix) then writeModTag(INFIX)
883883
if flags.is(Invisible) then writeModTag(INVISIBLE)
884-
if flags.is(SourceInvisible) then writeModTag(SOURCEINVISIBLE)
885884
if (flags.is(Erased)) writeModTag(ERASED)
886885
if (flags.is(Exported)) writeModTag(EXPORTED)
887886
if (flags.is(Given)) writeModTag(GIVEN)

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,6 @@ class TreeUnpickler(reader: TastyReader,
756756
case EXPORTED => addFlag(Exported)
757757
case OPEN => addFlag(Open)
758758
case INVISIBLE => addFlag(Invisible)
759-
case SOURCEINVISIBLE => addFlag(SourceInvisible)
760759
case TRANSPARENT => addFlag(Transparent)
761760
case INFIX => addFlag(Infix)
762761
case TRACKED => addFlag(Tracked)
@@ -1584,7 +1583,7 @@ class TreeUnpickler(reader: TastyReader,
15841583
(if !d.exists then lookupInSuper else d).asSeenFrom(prefix)
15851584

15861585
val denot = inContext(ctx.addMode(Mode.ResolveFromTASTy)):
1587-
searchDenot // able to resolve SourceInvisible members
1586+
searchDenot // able to resolve Invisible members
15881587

15891588

15901589
val sel = makeSelect(qual, name, denot)

compiler/src/dotty/tools/dotc/transform/UnrollDefinitions.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import dotty.tools.unreachable
2626
/**Implementation of SIP-61.
2727
* Runs when `@unroll` annotations are found in a compilation unit, installing new definitions
2828
*
29-
* Note that it only generates `SourceInvisible` methods, so no interactions with Zinc/SemanticDB
29+
* Note that it only generates `Invisible` methods, so no interactions with Zinc/SemanticDB
3030
*/
3131
class UnrollDefinitions extends MacroTransform, IdentityDenotTransformer {
3232
self =>
@@ -127,7 +127,7 @@ class UnrollDefinitions extends MacroTransform, IdentityDenotTransformer {
127127
defdef.symbol.owner,
128128
defdef.name,
129129
defdef.symbol.flags &~ HasDefaultParams |
130-
SourceInvisible | Synthetic,
130+
Invisible | Synthetic,
131131
NoType, // fill in later
132132
coord = nextSymbol.span.shift(1) // shift by 1 to avoid "secondary constructor must call preceding" error
133133
).entered

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2966,7 +2966,6 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
29662966
def Infix: Flags = dotc.core.Flags.Infix
29672967
def Inline: Flags = dotc.core.Flags.Inline
29682968
def Invisible: Flags = dotc.core.Flags.Invisible
2969-
def SourceInvisible: Flags = dotc.core.Flags.SourceInvisible
29702969
def JavaDefined: Flags = dotc.core.Flags.JavaDefined
29712970
def JavaStatic: Flags = dotc.core.Flags.JavaStatic
29722971
def JavaAnnotation: Flags = dotc.core.Flags.JavaAnnotation

library/src/scala/quoted/Quotes.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4624,10 +4624,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
46244624
/** Is this symbol invisible when typechecking? */
46254625
def Invisible: Flags
46264626

4627-
/** Is this symbol invisible when typechecking? (only from source) */
4628-
@experimental
4629-
def SourceInvisible: Flags
4630-
46314627
/** Is this symbol defined in a Java class */
46324628
def JavaDefined: Flags
46334629

tasty/src/dotty/tools/tasty/TastyFormat.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ Standard-Section: "ASTs" TopLevelStat*
227227
PARAMalias -- Parameter is alias of a superclass parameter
228228
EXPORTED -- An export forwarder
229229
OPEN -- an open class
230-
INVISIBLE -- invisible during typechecking
231-
SOURCEINVISIBLE -- invisible in the source code
230+
INVISIBLE -- invisible during typechecking, except when resolving from TASTy
232231
TRACKED -- a tracked class parameter / a dependent class
233232
Annotation
234233
@@ -512,7 +511,6 @@ object TastyFormat {
512511
final val EMPTYCLAUSE = 45
513512
final val SPLITCLAUSE = 46
514513
final val TRACKED = 47
515-
final val SOURCEINVISIBLE = 48
516514

517515
// Tree Cat. 2: tag Nat
518516
final val firstNatTreeTag = SHAREDterm
@@ -702,7 +700,6 @@ object TastyFormat {
702700
| EXPORTED
703701
| OPEN
704702
| INVISIBLE
705-
| SOURCEINVISIBLE
706703
| ANNOTATION
707704
| PRIVATEqualified
708705
| PROTECTEDqualified
@@ -767,7 +764,6 @@ object TastyFormat {
767764
case EXPORTED => "EXPORTED"
768765
case OPEN => "OPEN"
769766
case INVISIBLE => "INVISIBLE"
770-
case SOURCEINVISIBLE => "SOURCEINVISIBLE"
771767
case PARAMalias => "PARAMalias"
772768
case EMPTYCLAUSE => "EMPTYCLAUSE"
773769
case SPLITCLAUSE => "SPLITCLAUSE"

0 commit comments

Comments
 (0)