Skip to content

Commit 0fec780

Browse files
committed
Add additional test for annotation completions
1 parent bf7b455 commit 0fec780

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,18 @@ class CompletionTest {
897897
.completion(m1, Set())
898898

899899
@Test def i13624_annotType: Unit =
900-
code"""|class MyAnnotation extends annotation.StaticAnnotation
900+
code"""|object Foo{
901+
| class MyAnnotation extends annotation.StaticAnnotation
902+
|}
903+
|class MyAnnotation extends annotation.StaticAnnotation
904+
|class Annotation2(a: String) extends annotation.StaticAnnotation
901905
|val x = 1: @MyAnnot${m1}
902-
|type X = Int @MyAnnot${m2}""".withSource
906+
|type X = Int @MyAnnot${m2}
907+
|val y = 1: @Foo.MyAnnot${m3}
908+
|val z = 1: @Foo.MyAnnotation @MyAnno${m4}
909+
|type Y = Int @MyAnnotation @Foo.MyAnnota${m5}
910+
|val w = 1: @Annotation2("abc": @Foo.MyAnnot${m6})
911+
|""".withSource
903912
.completion(
904913
m1,
905914
Set(
@@ -912,4 +921,29 @@ class CompletionTest {
912921
("MyAnnotation", Class, "MyAnnotation"),
913922
("MyAnnotation", Module, "MyAnnotation")
914923
)
915-
)}
924+
).completion(
925+
m3,
926+
Set(
927+
("MyAnnotation", Class, "Foo.MyAnnotation"),
928+
("MyAnnotation", Module, "Foo.MyAnnotation")
929+
)
930+
).completion(
931+
m4,
932+
Set(
933+
("MyAnnotation", Class, "MyAnnotation"),
934+
("MyAnnotation", Module, "MyAnnotation")
935+
)
936+
).completion(
937+
m5,
938+
Set(
939+
("MyAnnotation", Class, "Foo.MyAnnotation"),
940+
("MyAnnotation", Module, "Foo.MyAnnotation")
941+
)
942+
).completion(
943+
m6,
944+
Set(
945+
("MyAnnotation", Class, "Foo.MyAnnotation"),
946+
("MyAnnotation", Module, "Foo.MyAnnotation")
947+
)
948+
)
949+
}

0 commit comments

Comments
 (0)