Skip to content

Commit 4733451

Browse files
committed
Make erased export forwarders inline methods
1 parent 0af89f0 commit 4733451

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
@@ -1326,6 +1326,7 @@ class Namer { typer: Typer =>
13261326
else mbr.info.ensureMethodic
13271327
(EmptyFlags, mbrInfo)
13281328
var mbrFlags = MandatoryExportTermFlags | maybeStable | (sym.flags & RetainedExportTermFlags)
1329+
if sym.is(Erased) then mbrFlags |= Inline
13291330
if pathMethod.exists then mbrFlags |= ExtensionMethod
13301331
val forwarderName = checkNoConflict(alias, span)
13311332
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)