Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove this-parameter filtering in statement completion
  • Loading branch information
ahejlsberg committed May 13, 2019
1 parent 5460281 commit 90667e1
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/compiler/checker.ts
Expand Up @@ -20386,25 +20386,7 @@ namespace ts {
}

function isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean {
return isValidPropertyAccessWithType(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, property.escapedName, type)
&& (!(property.flags & SymbolFlags.Method) || isValidMethodAccess(property, type));
}
function isValidMethodAccess(method: Symbol, actualThisType: Type): boolean {
const propType = getTypeOfPropertyOfType(actualThisType, method.escapedName)!;
const signatures = getSignaturesOfType(getNonNullableType(propType), SignatureKind.Call);
Debug.assert(signatures.length !== 0);
return signatures.some(sig => {
const signatureThisType = getThisTypeOfSignature(sig);
return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType));
});
}
function getInstantiatedSignatureThisType(sig: Signature, signatureThisType: Type, actualThisType: Type): Type {
if (!sig.typeParameters) {
return signatureThisType;
}
const context = createInferenceContext(sig.typeParameters, sig, InferenceFlags.None);
inferTypes(context.inferences, actualThisType, signatureThisType);
return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context)));
return isValidPropertyAccessWithType(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, property.escapedName, type);
}

function isValidPropertyAccessWithType(
Expand Down

0 comments on commit 90667e1

Please sign in to comment.