metals
metals copied to clipboard
Go to implementation doesn't work with self types
Describe the bug
Add this test to ImplementationSuite:
check(
"self-type",
"""|/a/src/main/scala/a/Main.scala
|trait A { def a@@a: Unit }
|trait B{
| this : A =>
| override def <<aa>>: Unit = ()
|}
|""".stripMargin
)
Expected behavior
The test should work
Operating system
Linux
Editor/Extension
VS Code
Version of Metals
v0.11.2
Extra context or search terms
Part of the solution would be to analyse self parameter together with normal parents, however another issue seems to be that the parent methods do not show in overridenSymbols collection. This is probably an issue with the compiler itself. Working around it would require comparing signatures as a fallback, which would take us back to the complex logic before.
Relatedly in Scala 2 REPL,
trait Repl {
def presentationCompile(cursor: Int, buf: String): Either[Result, PresentationCompilationResult]
}
trait PresentationCompilation { self: IMain =>
def presentationCompile(cursor: Int, buf: String): Either[Result, PresentationCompilationResult] = ???
}
class IMain(val settings: Settings, parentClassLoaderOverride: Option[ClassLoader], compilerSettings: Settings, val reporter: ReplReporter)
extends Repl with Imports with PresentationCompilation with Closeable
I want to navigate from the "interface" to the mix-in that implements it in the concrete class.