Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eta expand export forwarders that have context function types #15217

Merged
merged 1 commit into from May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/Erasure.scala
Expand Up @@ -385,7 +385,7 @@ object Erasure {
case _: FunProto | AnyFunctionProto => tree
case _ => tree.tpe.widen match
case mt: MethodType if tree.isTerm =>
assert(mt.paramInfos.isEmpty)
assert(mt.paramInfos.isEmpty)//, i"bad adapt for $tree: $mt")
adaptToType(tree.appliedToNone, pt)
case tpw =>
if (pt.isInstanceOf[ProtoType] || tree.tpe <:< pt)
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/typer/Namer.scala
Expand Up @@ -1229,6 +1229,7 @@ class Namer { typer: Typer =>
val (pathRefss, methRefss) = prefss.splitAt(extensionParamsCount(path.tpe.widen))
val ref = path.appliedToArgss(pathRefss).select(sym.asTerm)
ref.appliedToArgss(adaptForwarderParams(Nil, sym.info, methRefss))
.etaExpandCFT(using ctx.withOwner(forwarder))
})
if forwarder.isInlineMethod then
PrepareInlineable.registerInlineInfo(forwarder, ddef.rhs)
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotc/pos-test-pickling.blacklist
Expand Up @@ -18,6 +18,7 @@ i7740b.scala
i6507b.scala
i12299a.scala
i13871.scala
i15181.scala

# Tree is huge and blows stack for printing Text
i7034.scala
Expand Down
9 changes: 9 additions & 0 deletions tests/pos/i15181.scala
@@ -0,0 +1,9 @@
object prelude:
//def scombine[A](x: A, y: A): Semigroup[A] ?=> A = Semigroup.scombine(x,y)
export Semigroup.*

trait Semigroup[A]:
def scombine(x: A, y: A): A

object Semigroup:
def scombine[A](x: A, y: A) = (s: Semigroup[A]) ?=> s.scombine(x,y)