Closed
Description
Issue originally raised in Metals - scalameta/metals#4495
Reproduction steps
Scala version: 2.13.8, 2.13.9, probably earlier ones too
Here's repo with reproduction.
a/package.scala
package object a {
type FancyInt = Int
}
a/Main.scala
package a
object Main extends App {
def foo(n: FancyInt, k: Int): Unit = {
n
k
}
}
Problem
There are no completions for type alias
I initially thought that this is the problem with Metals but @tgodzik created a testcase with reproduction https://github.com/scalameta/metals/compare/main...tgodzik:metals:add-test?expand=1 which shows that this is the compiler issue.
This is what Metals gets from compiler:
CompletionProvider.scala:451 typeMembers: List(
ScopeMember(
sym = value n,
tpe = <error>,
accessible = true,
viaImport = <empty>,
aliasInfo = None
),
ScopeMember(
sym = value k,
tpe = TypeRef(pre = ThisType(sym = package scala), sym = class Int, args = List()),
accessible = true,
viaImport = <empty>,
aliasInfo = None
),
...
note tpe = <error>
for n
whereas k
has correct tpe.