File tree 2 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/ast
language-server/test/dotty/tools/languageserver
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -520,7 +520,14 @@ object desugar {
520
520
enumCases.last.pushAttachment(DesugarEnums .DefinesEnumLookupMethods , ())
521
521
val enumCompanionRef = TermRefTree ()
522
522
val enumImport =
523
- Import (enumCompanionRef, enumCases.flatMap(caseIds).map(ImportSelector (_)))
523
+ Import (enumCompanionRef, enumCases.flatMap(caseIds).map{
524
+ enumCase =>
525
+ val zeroSpan = if enumCase.span.exists then
526
+ enumCase.span.endPos
527
+ else
528
+ enumCase.span
529
+ ImportSelector (enumCase.withSpan(zeroSpan)).withSpan(zeroSpan)
530
+ })
524
531
(enumImport :: enumStats, enumCases, enumCompanionRef)
525
532
}
526
533
else (stats, Nil , EmptyTree )
Original file line number Diff line number Diff line change @@ -213,4 +213,13 @@ class HoverTest {
213
213
// sp the top-level definitions should be enclosed in an object called `Source0$package`.
214
214
.hover(m1 to m2, hoverContent(" (hello.Source0$package : hello.Source0$package.type)" ))
215
215
}
216
+
217
+ @ Test def enumsRepeated : Unit = {
218
+ code """ |package example
219
+ |object SimpleEnum:
220
+ | enum Color:
221
+ | case ${m1}Red ${m2}, Green, Blue
222
+ | """ .withSource
223
+ .hover(m1 to m2, hoverContent(" example.SimpleEnum.Color" ))
224
+ }
216
225
}
You can’t perform that action at this time.
0 commit comments