Skip to content

Commit 63f62b7

Browse files
authored
Merge pull request #6564 from dotty-staging/change-export-extension
Make export forwarders retain Extension flag
2 parents 2984e57 + 542bccc commit 63f62b7

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ object Flags {
594594

595595
final val ImplicitOrImpliedOrGivenTerm = ImplicitOrImpliedOrGiven.toTermFlags
596596

597+
/** Flags retained in export forwarders */
598+
final val RetainedExportFlags = ImplicitOrImpliedOrGiven | Extension
599+
597600
/** Assumed to be pure */
598601
final val StableOrErased: FlagSet = StableRealizable | Erased
599602

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ class Namer { typer: Typer =>
988988
val maybeStable = if (mbr.symbol.isStableMember) StableRealizable else EmptyFlags
989989
ctx.newSymbol(
990990
cls, alias,
991-
Exported | Method | Final | maybeStable | mbr.symbol.flags & ImplicitOrImpliedOrGiven,
991+
Exported | Method | Final | maybeStable | mbr.symbol.flags & RetainedExportFlags,
992992
mbr.info.ensureMethodic,
993993
coord = span)
994994
}

tests/run/exports.check

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ config
22
printing
33
scanning
44
config
5+
printing
6+
scanning
7+
scanning

tests/run/exports.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ object Test extends App {
1212

1313
class Scanner {
1414
def scan() = println("scanning")
15+
def (x: Any) scanned = scan()
1516
}
1617
object Scanner extends Scanner
1718

@@ -29,6 +30,16 @@ object Test extends App {
2930
Copier.cfg
3031
Copier.config
3132
Copier.config2
33+
34+
def test() = {
35+
import Copier._
36+
print()
37+
scanIt()
38+
val x = config2
39+
val y = cfg
40+
1.scanned
41+
}
42+
test()
3243
}
3344

3445
final class Foo {

0 commit comments

Comments
 (0)