From 90667e104df18bce0e0457d90393b54f2b9a9730 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 13 May 2019 12:42:33 -0700 Subject: [PATCH] Remove this-parameter filtering in statement completion --- src/compiler/checker.ts | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 64834befee1c8..b730f382db3dd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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(