Skip to content

Commit 0e5f488

Browse files
committed
Make erased export forwarders inline methods
1 parent e57412e commit 0e5f488

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ object Flags {
540540
val RetainedModuleClassFlags: FlagSet = RetainedModuleValAndClassFlags | Enum
541541

542542
/** Flags retained in term export forwarders */
543-
val RetainedExportTermFlags = Infix | Given | Implicit | Inline | Transparent | Erased | HasDefaultParams | NoDefaultParams | ExtensionMethod
543+
val RetainedExportTermFlags = Infix | Given | Implicit | Inline | Transparent | HasDefaultParams | NoDefaultParams | ExtensionMethod
544544

545545
/** Flags retained in parameters of term export forwarders */
546546
val RetainedExportTermParamFlags = Given | Implicit | Erased | HasDefault | Inline

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ class Namer { typer: Typer =>
13251325
else mbr.info.ensureMethodic
13261326
(EmptyFlags, mbrInfo)
13271327
var mbrFlags = MandatoryExportTermFlags | maybeStable | (sym.flags & RetainedExportTermFlags)
1328+
if sym.is(Erased) then mbrFlags |= Inline
13281329
if pathMethod.exists then mbrFlags |= ExtensionMethod
13291330
val forwarderName = checkNoConflict(alias, span)
13301331
newSymbol(cls, forwarderName, mbrFlags, mbrInfo, coord = span)

tests/pos/erased-export.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import language.experimental.erasedDefinitions
2+
3+
class C(x: Int):
4+
erased val e = x
5+
6+
class D:
7+
val c = C(22)
8+
export c.*
9+
erased val x = e

0 commit comments

Comments
 (0)