File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -2864,12 +2864,16 @@ export class Resolver extends DiagnosticEmitter {
28642864 // Instance method prototypes are pre-bound to their concrete class as their parent
28652865 if ( prototype . is ( CommonFlags . Instance ) ) {
28662866
2867+ // The actual class instance may be a subclass of the bound class in the case of
2868+ // a function or property that uses the polymorphic `this` type
28672869 if ( this . currentThisExpression && ctxFlow ) {
28682870 let element = this . lookupExpression ( this . currentThisExpression , ctxFlow ) ;
28692871 if ( element ?. kind == ElementKind . Class ) {
28702872 classInstance = < Class > element ;
28712873 }
28722874 }
2875+
2876+ // Otherwise, the bound class is the actual class instance
28732877 if ( ! classInstance ) {
28742878 classInstance = assert ( prototype . getBoundClassOrInterface ( ) ) ;
28752879 }
@@ -3013,6 +3017,7 @@ export class Resolver extends DiagnosticEmitter {
30133017
30143018 // check against overridden base member
30153019 if ( prototype . is ( CommonFlags . Instance ) ) {
3020+ // always take the prototype's bound class here - which may differ from the previous classInstance
30163021 let classInstance = assert ( prototype . getBoundClassOrInterface ( ) ) ;
30173022 let methodOrPropertyName = instance . declaration . name . text ;
30183023 let baseClass = classInstance . base ;
You can’t perform that action at this time.
0 commit comments