Closed
Description
Compiler version
3.1.3
Minimized code
This code is from CompletionSnippetSuite
in Metals which is run by the specified scala version.
@@
represents the cursor position.
object Main {
new scala.Iterabl@@
}
Output
calling Completion.completions(pos)
from Dotty API, produces
List(
Completion(
label = "Iterable",
description = "=> collection.Iterable.type",
symbols = List(method Iterable)
),
Completion(
label = "IterableOnce",
description = "scala.IterableOnce",
symbols = List(type IterableOnce)
),
Completion(label = "Iterable", description = "scala.Iterable", symbols = List(type Iterable))
)
Now the problem with the flags is that, for the last two items on the list, which are trait
s actually,
- the
symbol.is(Flags.Trait)
returnsfalse
; - while
symbol.info.typeSymbol.is(Flags.Trait)
andsymbol.info.typeSymbol.is(Trait)
returntrue
.
This is problematic for using the API for completions, such as when deciding whether to insert {}
or when filtering results.
You might be interested in taking a look at these comments on the this PR for Scala 3 type completions in Metals.
Expectation
It is better if the flags are correctly set and are consistent.