'this' Typing
c foo(): C { return this; }
D bar(): D { return this; }
class C {
f() {
var x: this;
var c: C;
c = x;
}
}
this <: C
is like:
class C<this extends C> {
f() {
var x: this;
var c: C;
c = x;
}
}
this will no longer work:
class C<this extends C> {
f() {
var x = this;
x = new C();
}
}
because C is not assignment compatible with x, because x : this