super's containing class doesn't require base node
In a class nested inside a constructor, `super` refers to the outer class' `super`, but when resolving a super call its containing class is identified as the immediately containing class. Previously, the compiler crashed, preventing the error from being reported correctly. Now it handles this disparity and correctly reports the error.
This commit is contained in:
parent
49a9d64e87
commit
67b2a17034
|
@ -10112,8 +10112,10 @@ namespace ts {
|
|||
// In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated
|
||||
// with the type arguments specified in the extends clause.
|
||||
const baseTypeNode = getClassExtendsHeritageClauseElement(getContainingClass(node));
|
||||
const baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);
|
||||
return resolveCall(node, baseConstructors, candidatesOutArray);
|
||||
if (baseTypeNode) {
|
||||
const baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);
|
||||
return resolveCall(node, baseConstructors, candidatesOutArray);
|
||||
}
|
||||
}
|
||||
return resolveUntypedCall(node);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue