Skip to content

Commit f824994

Browse files
ghostbuster91spavikeviktgodzikanatoliykmetyuk
committed
Fix missing code-completion on standalone annotations
Co-authored-by: Stefan Pavikevik <[email protected]> Co-authored-by: Tomasz Godzik <[email protected]> Co-authored-by: Anatolii Kmetiuk <[email protected]>
1 parent 968dd1b commit f824994

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3469,7 +3469,11 @@ object Parsers {
34693469
givenDef(start, mods, atSpan(in.skipToken()) { Mod.Given() })
34703470
case _ =>
34713471
syntaxErrorOrIncomplete(ExpectedStartOfTopLevelDefinition())
3472-
EmptyTree
3472+
mods.annotations match {
3473+
case head :: Nil => head
3474+
case Nil => EmptyTree
3475+
case all => Block(all, errorTermTree)
3476+
}
34733477
}
34743478

34753479
/** ClassDef ::= id ClassConstr TemplateOpt

compiler/test/dotty/tools/repl/TabcompleteTests.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,8 @@ class TabcompleteTests extends ReplTest {
138138
tabComplete("import quoted.* ; def fooImpl(using Quotes): Expr[Int] = { import quotes.reflect.* ; TypeRepr.of[Int].s"))
139139
}
140140

141+
@Test def i13624 = fromInitialState { implicit s =>
142+
assertEquals(List("implicitNotFound"), tabComplete("@annotation.implicitNot"))
143+
assertEquals(List("main"), tabComplete("@annotation.implicitNotFound @mai"))
144+
}
141145
}

0 commit comments

Comments
 (0)