Skip to content

Commit cbff98d

Browse files
committed
Fix inline + export combination
Exported functions could be inline, but that did not work at all. This should be fixed by this commit.
1 parent 6fb3c53 commit cbff98d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ class Namer { typer: Typer =>
11361136
newSymbol(cls, forwarderName, mbrFlags, mbrInfo, coord = span)
11371137

11381138
forwarder.info = avoidPrivateLeaks(forwarder)
1139-
forwarder.addAnnotations(sym.annotations)
1139+
forwarder.addAnnotations(sym.annotations.filterConserve(_.symbol != defn.BodyAnnot))
11401140

11411141
if forwarder.isType then
11421142
buf += tpd.TypeDef(forwarder.asType).withSpan(span)

tests/run/i14020.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
class A:
22
def greeting(name: String = "you") = s"Hello $name"
33

4+
class A2:
5+
inline def greeting(name: String = "you") = s"Hello $name"
6+
47
class B:
58
val a = A()
69
export a.*
710

811
class C:
9-
val a = A()
12+
val a = A2()
1013
export a.greeting
1114

1215
@main def Test =
@@ -27,6 +30,7 @@ class C:
2730

2831
println(summon[String]) // error: I found: w.bark(/* missing */summon[String])
2932

33+
3034
class Dog:
3135
given bark(using msg: String = "Woof!"): String = s"bark: $msg"
3236

0 commit comments

Comments
 (0)