Skip to content

Don't use suffix _ in eta expansion #11314

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

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,8 @@ object EtaExpansion extends LiftImpure {
var ids: List[Tree] = mt.paramNames map (name => Ident(name).withSpan(tree.span.startPos))
if (mt.paramInfos.nonEmpty && mt.paramInfos.last.isRepeatedParam)
ids = ids.init :+ repeated(ids.last)
val app = Apply(lifted, ids)
if (mt.isContextualMethod) app.setApplyKind(ApplyKind.Using)
val body = if (isLastApplication) app else PostfixOp(app, Ident(nme.WILDCARD))
val body = Apply(lifted, ids)
if (mt.isContextualMethod) body.setApplyKind(ApplyKind.Using)
val fn =
if (mt.isContextualMethod) new untpd.FunctionWithMods(params, body, Modifiers(Given))
else if (mt.isImplicitMethod) new untpd.FunctionWithMods(params, body, Modifiers(Implicit))
Expand Down
4 changes: 4 additions & 0 deletions tests/pos/i11311.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object Test:

def cat1(s1: String)(s2: String) = s1 + s2
val fcat1 = cat1