In Source Insight, click Options -> Preferences... and import Python.CLF.
Then in Options -> Document Options..., click 'Add Type...' and add Python Source File. Settings are shown below:
Finish.
class A { def method1 = this }
class B extends A { def method2 = this }
val b = new B
scala> b.method1.getClass
res29: Class[_ <: A] = class B
b.method1.method2:scala> b.method1.method2
<console>:11: error: value method2 is not a member of A
b.method1.method2
class A { def method1: this.type = this }
class B extends A { def method2: this.type = this }
val b = new B
b.method1:scala> b.method1.getClass
res31: Class[_ <: B] = class B
b.method1.method2 works:scala> b.method1.method2
res32: b.type = B@4ff3ac
Class[_ <: A] = class B and Class[_ <: B] = class B? And why does the first doesn't work as Class[_ <: A] = class B seems to say that it's also class B?Class[_ <: A] = class B. The first part, Class[_ <: A] tells you what the compiler knows at compile time, that b.method1 returns something of type Class[_ <: A]. The second part, class B mentions that you have a class B as value, but the compiler doesn't know that. That's runtime information.this.type specializes the method for subclasses, where the type inferred from a plain thisdoesn't.