Skip to content

Commit 2452ac8

Browse files
committed
New flag Exported for export forwarders
1 parent c9e87b4 commit 2452ac8

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ object Flags {
394394
/** Symbol is an enum class or enum case (if used with case) */
395395
final val Enum: FlagSet = commonFlag(40, "<enum>")
396396

397+
/** An export forwarder */
398+
final val Exported: FlagSet = commonFlag(41, "exported")
399+
397400
/** Labeled with `erased` modifier (erased value) */
398401
final val Erased: FlagSet = termFlag(42, "erased")
399402

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ Standard-Section: "ASTs" TopLevelStat*
208208
EXTENSION -- An extension method
209209
GIVEN -- A new style implicit parameter, introduced with `given`
210210
PARAMsetter -- The setter part `x_=` of a var parameter `x` which itself is pickled as a PARAM
211+
EXPORTED -- An export forwarder
211212
Annotation
212213
213214
Annotation = ANNOTATION Length tycon_Type fullAnnotation_Term -- An annotation, given (class) type of constructor, and full application tree
@@ -329,6 +330,7 @@ object TastyFormat {
329330
final val GIVEN = 37
330331
final val IMPLIED = 38
331332
final val PARAMsetter = 39
333+
final val EXPORTED = 40
332334

333335
// Cat. 2: tag Nat
334336

@@ -457,7 +459,7 @@ object TastyFormat {
457459

458460
/** Useful for debugging */
459461
def isLegalTag(tag: Int): Boolean =
460-
firstSimpleTreeTag <= tag && tag <= PARAMsetter ||
462+
firstSimpleTreeTag <= tag && tag <= EXPORTED ||
461463
firstNatTreeTag <= tag && tag <= SYMBOLconst ||
462464
firstASTTreeTag <= tag && tag <= SINGLETONtpt ||
463465
firstNatASTTreeTag <= tag && tag <= NAMEDARG ||
@@ -500,6 +502,7 @@ object TastyFormat {
500502
| EXTENSION
501503
| GIVEN
502504
| PARAMsetter
505+
| EXPORTED
503506
| ANNOTATION
504507
| PRIVATEqualified
505508
| PROTECTEDqualified => true
@@ -560,6 +563,7 @@ object TastyFormat {
560563
case EXTENSION => "EXTENSION"
561564
case GIVEN => "GIVEN"
562565
case PARAMsetter => "PARAMsetter"
566+
case EXPORTED => "EXPORTED"
563567

564568
case SHAREDterm => "SHAREDterm"
565569
case SHAREDtype => "SHAREDtype"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ class TreePickler(pickler: TastyPickler) {
656656
if (flags is Extension) writeByte(EXTENSION)
657657
if (flags is Given) writeByte(GIVEN)
658658
if (flags is ParamAccessor) writeByte(PARAMsetter)
659+
if (flags is Exported) writeByte(EXPORTED)
659660
assert(!(flags is Label))
660661
} else {
661662
if (flags is Sealed) writeByte(SEALED)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,8 @@ class TreeUnpickler(reader: TastyReader,
632632
case STABLE => addFlag(StableRealizable)
633633
case EXTENSION => addFlag(Extension)
634634
case GIVEN => addFlag(Given)
635-
case PARAMsetter =>
636-
addFlag(ParamAccessor)
635+
case PARAMsetter => addFlag(ParamAccessor)
636+
case EXPORTED => addFlag(Exported)
637637
case PRIVATEqualified =>
638638
readByte()
639639
privateWithin = readWithin(ctx)

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,14 +981,14 @@ class Namer { typer: Typer =>
981981
if (mbr.isType)
982982
ctx.newSymbol(
983983
cls, alias.toTypeName,
984-
Final,
984+
Exported | Final,
985985
fwdInfo(path.tpe.select(mbr.symbol), mbr.info),
986986
coord = span)
987987
else {
988988
val maybeStable = if (mbr.symbol.isStableMember) StableRealizable else EmptyFlags
989989
ctx.newSymbol(
990990
cls, alias,
991-
Method | Final | maybeStable | mbr.symbol.flags & ImplicitOrImplied,
991+
Exported | Method | Final | maybeStable | mbr.symbol.flags & ImplicitOrImplied,
992992
mbr.info.ensureMethodic,
993993
coord = span)
994994
}

0 commit comments

Comments
 (0)