Skip to content

Commit

Permalink
Fix inline + export combination
Browse files Browse the repository at this point in the history
Exported functions could be inline, but that did not work at all. This should
be fixed by this commit.
  • Loading branch information
odersky committed Dec 10, 2021
1 parent 6fb3c53 commit cbff98d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ class Namer { typer: Typer =>
newSymbol(cls, forwarderName, mbrFlags, mbrInfo, coord = span)

forwarder.info = avoidPrivateLeaks(forwarder)
forwarder.addAnnotations(sym.annotations)
forwarder.addAnnotations(sym.annotations.filterConserve(_.symbol != defn.BodyAnnot))

if forwarder.isType then
buf += tpd.TypeDef(forwarder.asType).withSpan(span)
Expand Down
6 changes: 5 additions & 1 deletion tests/run/i14020.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
class A:
def greeting(name: String = "you") = s"Hello $name"

class A2:
inline def greeting(name: String = "you") = s"Hello $name"

class B:
val a = A()
export a.*

class C:
val a = A()
val a = A2()
export a.greeting

@main def Test =
Expand All @@ -27,6 +30,7 @@ class C:

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


class Dog:
given bark(using msg: String = "Woof!"): String = s"bark: $msg"

Expand Down

0 comments on commit cbff98d

Please sign in to comment.