Skip to content

Commit 6c3edae

Browse files
Backport "fix: make vals created in desugaring of n-ary lambdas non-synthetic" to 3.7.4 (#24050)
Backports #23896 to the 3.7.4. PR submitted by the release tooling. [skip ci]
2 parents 7ff0e87 + a67481c commit 6c3edae

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,6 @@ object desugar {
19681968
ValDef(param.name, param.tpt, selector(idx))
19691969
.withSpan(param.span)
19701970
.withAttachment(UntupledParam, ())
1971-
.withFlags(Synthetic)
19721971
}
19731972
Function(param :: Nil, Block(vdefs, body))
19741973
}

presentation-compiler/src/main/dotty/tools/pc/PcConvertToNamedLambdaParameters.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ object PcConvertToNamedLambdaParameters:
120120
}
121121

122122
def isWildcardParam(param: tpd.ValDef)(using Context): Boolean =
123-
param.name.toString.startsWith("_$") && param.symbol.is(Flags.Synthetic)
123+
param.name.toString.startsWith("_$")
124124

125125
def findParamReferencePosition(param: tpd.ValDef, lambda: tpd.Tree)(using Context): Option[SourcePosition] =
126126
var pos: Option[SourcePosition] = None

presentation-compiler/test/dotty/tools/pc/tests/hover/HoverTermSuite.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ import org.junit.Test
66

77
class HoverTermSuite extends BaseHoverSuite:
88

9+
@Test def `n-ary lamba` =
10+
check(
11+
"""|object testRepor {
12+
| val listOfTuples = List(1 -> 1, 2 -> 2, 3 -> 3)
13+
|
14+
| listOfTuples.map((k@@ey, value) => key + value)
15+
|}
16+
|""".stripMargin,
17+
"""|val key: Int
18+
|""".stripMargin.hover
19+
)
20+
921
@Test def `map` =
1022
check(
1123
"""object a {

0 commit comments

Comments
 (0)