Skip to content

Commit 9d68778

Browse files
Merge pull request #15217 from dotty-staging/fix-15181
Eta expand export forwarders that have context function types
2 parents 6783853 + 8748cff commit 9d68778

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,7 @@ class Namer { typer: Typer =>
12291229
val (pathRefss, methRefss) = prefss.splitAt(extensionParamsCount(path.tpe.widen))
12301230
val ref = path.appliedToArgss(pathRefss).select(sym.asTerm)
12311231
ref.appliedToArgss(adaptForwarderParams(Nil, sym.info, methRefss))
1232+
.etaExpandCFT(using ctx.withOwner(forwarder))
12321233
})
12331234
if forwarder.isInlineMethod then
12341235
PrepareInlineable.registerInlineInfo(forwarder, ddef.rhs)

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)