Skip to content

Commit 73dc017

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 ad5c714 commit 73dc017

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
@@ -3472,7 +3472,11 @@ object Parsers {
34723472
givenDef(start, mods, atSpan(in.skipToken()) { Mod.Given() })
34733473
case _ =>
34743474
syntaxErrorOrIncomplete(ExpectedStartOfTopLevelDefinition())
3475-
EmptyTree
3475+
mods.annotations match {
3476+
case head :: Nil => head
3477+
case Nil => EmptyTree
3478+
case all => Block(all, errorTermTree)
3479+
}
34763480
}
34773481

34783482
/** 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)