File tree 2 files changed +25
-2
lines changed
compiler/src/dotty/tools/dotc/parsing
language-server/test/dotty/tools/languageserver
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -1699,8 +1699,8 @@ object Parsers {
1699
1699
case pt @ Ident (tpnme.WILDCARD_STAR ) =>
1700
1700
migrationWarningOrError(" The syntax `x @ _*' is no longer supported; use `x : _*' instead" , startOffset(p))
1701
1701
atPos(startOffset(p), offset) { Typed (p, pt) }
1702
- case p =>
1703
- atPos(startOffset(p), offset ) { Bind (name, p ) }
1702
+ case pt =>
1703
+ atPos(startOffset(p), 0 ) { Bind (name, pt ) }
1704
1704
}
1705
1705
case p @ Ident (tpnme.WILDCARD_STAR ) =>
1706
1706
// compatibility for Scala2 `_*` syntax
Original file line number Diff line number Diff line change @@ -344,4 +344,27 @@ class DefinitionTest {
344
344
.definition(m15 to m16, List (m7 to m8))
345
345
}
346
346
347
+ @ Test def goToBinding : Unit = {
348
+ withSources(
349
+ code """ class Foo {
350
+ |val x = Some(6)
351
+ |x match {
352
+ | case ${m1}x ${m2} @ Some(_) => ${m3}x ${m4}
353
+ |}
354
+ |x match {
355
+ | case ${m5}xyz ${m6} @ None => ${m7}xyz ${m8}
356
+ |}
357
+ |val y: Any = ???
358
+ |y match {
359
+ | case ${m9}a ${m10} @ Some( ${m11}bb ${m12} @ Some( ${m13}ccc ${m14})) =>
360
+ | ${m15}a ${m16}
361
+ | ${m17}bb ${m18}
362
+ | ${m19}ccc ${m20}
363
+ |} """
364
+ ) .definition(m3 to m4, List (m1 to m2))
365
+ .definition(m7 to m8, List (m5 to m6))
366
+ .definition(m15 to m16, List (m9 to m10))
367
+ .definition(m17 to m18, List (m11 to m12))
368
+ .definition(m19 to m20, List (m13 to m14))
369
+ }
347
370
}
You can’t perform that action at this time.
0 commit comments