Skip to content

Commit 90c0cb6

Browse files
kasiaMarektgodzik
authored andcommitted
fix: make vals created in desugaring of n-ary lambdas non-synthetic (scala#23896)
resolves: scala#16110 resolves: scalameta/metals#7594 [Cherry-picked 5f470ea]
1 parent 6e45d24 commit 90c0cb6

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
@@ -1526,7 +1526,6 @@ object desugar {
15261526
ValDef(param.name, param.tpt, selector(idx))
15271527
.withSpan(param.span)
15281528
.withAttachment(UntupledParam, ())
1529-
.withFlags(Synthetic)
15301529
}
15311530
Function(param :: Nil, Block(vdefs, body))
15321531
}

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)