diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index c6995cbac6b7..8f0abf9cd999 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -1158,7 +1158,7 @@ object desugar { mods & Lazy | Synthetic | (if (ctx.owner.isClass) PrivateLocal else EmptyFlags) val firstDef = ValDef(tmpName, TypeTree(), matchExpr) - .withSpan(pat.span.union(rhs.span)).withMods(patMods) + .withSpan(pat.span.startPos).withMods(patMods) val useSelectors = vars.length <= 22 def selector(n: Int) = if useSelectors then Select(Ident(tmpName), nme.selectorName(n)) diff --git a/language-server/test/dotty/tools/languageserver/HoverTest.scala b/language-server/test/dotty/tools/languageserver/HoverTest.scala index b396f1a15044..f23aac2ad6b6 100644 --- a/language-server/test/dotty/tools/languageserver/HoverTest.scala +++ b/language-server/test/dotty/tools/languageserver/HoverTest.scala @@ -231,4 +231,10 @@ class HoverTest { |""".withSource .hover(m1 to m2, hoverContent("example.TestEnum3")) } + + @Test def tuple: Unit = { + code"""|object A: + | val (${m1}first${m2}, second) = (1, 2)""".withSource + .hover(m1 to m2, hoverContent("Int")) + } }