Premature class `this` specialization
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
For `this` return type on a class method, `super`-based method calls from an extension class see the superclass type instead of `this` type, e.g.
```js
class A {
self(): this {
return this;
}
}
const K: Class = A; // `self(): this` \mapsto `self(): A`
class B extends K {
self(): this { // false negative from Flow
return super.self();
}
}
```
```
11: return super.self();
^ A. This type is incompatible with the expected return type of
10: self(): this {
^ B
11: return super.self();
^ A. This type is incompatible with the expected return type of
10: self(): this {
^ some incompatible instantiation of `this`
```
Contributor guide
Assessment
This issue has not been assessed yet.