Skip to content

Commit 96b9bca

Browse files
oderskyKordyjan
authored andcommitted
Eta expand export forwarders that have contetx function types
Fixes #15181
1 parent f7f239c commit 96b9bca

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

compiler/src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ object Erasure {
385385
case _: FunProto | AnyFunctionProto => tree
386386
case _ => tree.tpe.widen match
387387
case mt: MethodType if tree.isTerm =>
388-
assert(mt.paramInfos.isEmpty)
388+
assert(mt.paramInfos.isEmpty)//, i"bad adapt for $tree: $mt")
389389
adaptToType(tree.appliedToNone, pt)
390390
case tpw =>
391391
if (pt.isInstanceOf[ProtoType] || tree.tpe <:< pt)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,8 @@ class Namer { typer: Typer =>
11761176
import tpd._
11771177
val ref = path.select(sym.asTerm)
11781178
val ddef = tpd.DefDef(forwarder.asTerm, prefss =>
1179-
ref.appliedToArgss(adaptForwarderParams(Nil, sym.info, prefss)))
1179+
ref.appliedToArgss(adaptForwarderParams(Nil, sym.info, prefss))
1180+
.etaExpandCFT(using ctx.withOwner(forwarder)))
11801181
if forwarder.isInlineMethod then
11811182
PrepareInlineable.registerInlineInfo(forwarder, ddef.rhs)
11821183
buf += ddef.withSpan(span)

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ i7740b.scala
1818
i6507b.scala
1919
i12299a.scala
2020
i13871.scala
21+
i15181.scala
2122

2223
# Tree is huge and blows stack for printing Text
2324
i7034.scala

tests/pos/i15181.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
object prelude:
2+
//def scombine[A](x: A, y: A): Semigroup[A] ?=> A = Semigroup.scombine(x,y)
3+
export Semigroup.*
4+
5+
trait Semigroup[A]:
6+
def scombine(x: A, y: A): A
7+
8+
object Semigroup:
9+
def scombine[A](x: A, y: A) = (s: Semigroup[A]) ?=> s.scombine(x,y)

0 commit comments

Comments
 (0)