Skip to content

Commit dbfe1b5

Browse files
authored
Merge pull request #14499 from tgodzik/fix-11919
Set zero span for synthetic tuple type
2 parents 24fdf53 + df9736d commit dbfe1b5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ object desugar {
11581158
mods & Lazy | Synthetic | (if (ctx.owner.isClass) PrivateLocal else EmptyFlags)
11591159
val firstDef =
11601160
ValDef(tmpName, TypeTree(), matchExpr)
1161-
.withSpan(pat.span.union(rhs.span)).withMods(patMods)
1161+
.withSpan(pat.span.startPos).withMods(patMods)
11621162
val useSelectors = vars.length <= 22
11631163
def selector(n: Int) =
11641164
if useSelectors then Select(Ident(tmpName), nme.selectorName(n))

language-server/test/dotty/tools/languageserver/HoverTest.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,10 @@ class HoverTest {
231231
|""".withSource
232232
.hover(m1 to m2, hoverContent("example.TestEnum3"))
233233
}
234+
235+
@Test def tuple: Unit = {
236+
code"""|object A:
237+
| val (${m1}first${m2}, second) = (1, 2)""".withSource
238+
.hover(m1 to m2, hoverContent("Int"))
239+
}
234240
}

0 commit comments

Comments
 (0)