E036: Dangling This In Path
Note: This error was removed before Scala 3.0.0 was released and was never emitted by the Scala 3 compiler.
What it did
This error was triggered when using this at the end of an import path or type selection without selecting a member.
Example
trait Outer {
val member: Int
type Member
trait Inner {
import Outer.this
}
}
Error
-- [E036] Syntax Error: example.scala:5:11 -------------------------------------
5 | import Outer.this
| ^^^^^^^^^^
| Expected an additional member selection after the keyword `this`
Explanation
Paths of imports and type selections must not end with the keyword this. The compiler expected an additional member selection after this.
Valid usages required selecting a member:
trait Outer {
val member: Int
type Member
trait Inner {
// Valid: selecting a member after this
import Outer.this.member
// Valid: type selection
type T = Outer.this.Member
}
}
In this article