@zzzen/pyright-internal 1.2.0-dev.20220731 → 1.2.0-dev.20220821
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/binder.js +9 -6
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +6 -7
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.js +13 -7
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +5 -13
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/docStringConversion.js +8 -7
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/importResolver.js +2 -2
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.d.ts +2 -1
- package/dist/analyzer/importStatementUtils.d.ts +6 -2
- package/dist/analyzer/importStatementUtils.js +9 -38
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +26 -13
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/program.d.ts +7 -3
- package/dist/analyzer/program.js +34 -12
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/service.d.ts +6 -2
- package/dist/analyzer/service.js +6 -3
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +3 -1
- package/dist/analyzer/sourceFile.js +6 -0
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +126 -75
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +8 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js +1 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
- package/dist/analyzer/typeGuards.js +38 -9
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.js +1 -3
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +2 -2
- package/dist/analyzer/typeUtils.js +102 -61
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.d.ts +3 -3
- package/dist/analyzer/typedDicts.js +9 -5
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +6 -1
- package/dist/analyzer/types.js +32 -38
- package/dist/analyzer/types.js.map +1 -1
- package/dist/common/diagnostic.d.ts +5 -1
- package/dist/common/diagnostic.js +34 -0
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/languageServerBase.d.ts +6 -5
- package/dist/languageServerBase.js +28 -17
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.js +4 -2
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +23 -17
- package/dist/languageService/autoImporter.js +42 -30
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/codeActionProvider.js +1 -1
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +2 -1
- package/dist/languageService/completionProvider.js +8 -49
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.js +5 -8
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importAdder.d.ts +2 -1
- package/dist/languageService/importAdder.js +9 -3
- package/dist/languageService/importAdder.js.map +1 -1
- package/dist/languageService/quickActions.js +1 -1
- package/dist/languageService/quickActions.js.map +1 -1
- package/dist/languageService/renameModuleProvider.js +2 -2
- package/dist/languageService/renameModuleProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.js +3 -3
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/tooltipUtils.d.ts +3 -2
- package/dist/languageService/tooltipUtils.js +30 -15
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +1 -1
- package/dist/parser/parser.d.ts +1 -0
- package/dist/parser/parser.js +17 -8
- package/dist/parser/parser.js.map +1 -1
- package/dist/pyright.js +3 -0
- package/dist/pyright.js.map +1 -1
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js +2 -0
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +1 -1
- package/dist/tests/docStringConversion.test.js +21 -21
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js +15 -2
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js +12 -7
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.js +4 -2
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.d.ts +8 -2
- package/dist/tests/harness/fourslash/testState.js +50 -41
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/importAdder.test.js +17 -2
- package/dist/tests/importAdder.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +8 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +5 -1
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +6 -2
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/workspaceMap.js +18 -15
- package/dist/workspaceMap.js.map +1 -1
- package/package.json +1 -1
@@ -218,7 +218,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
218
218
|
const asymmetricDescriptorAssignmentCache = new Set();
|
219
219
|
const speculativeTypeTracker = new typeCache_1.SpeculativeTypeTracker();
|
220
220
|
const suppressedNodeStack = [];
|
221
|
-
let functionRecursionMap = new
|
221
|
+
let functionRecursionMap = new Set();
|
222
222
|
let codeFlowAnalyzerCache = new Map();
|
223
223
|
let typeCache = new Map();
|
224
224
|
let effectiveTypeCache = new Map();
|
@@ -265,7 +265,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
265
265
|
// circular references in complex data structures, so it fails
|
266
266
|
// to clean up the objects if we don't help it out.
|
267
267
|
function disposeEvaluator() {
|
268
|
-
functionRecursionMap = new
|
268
|
+
functionRecursionMap = new Set();
|
269
269
|
codeFlowAnalyzerCache = new Map();
|
270
270
|
typeCache = new Map();
|
271
271
|
effectiveTypeCache = new Map();
|
@@ -1884,11 +1884,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
1884
1884
|
return (suppressedNodeStack.some((suppressedNode) => ParseTreeUtils.isNodeContainedWithin(node, suppressedNode)) ||
|
1885
1885
|
speculativeTypeTracker.isSpeculative(node));
|
1886
1886
|
}
|
1887
|
-
function addDiagnostic(diagLevel, rule, message, node) {
|
1887
|
+
function addDiagnostic(diagLevel, rule, message, node, range) {
|
1888
1888
|
if (diagLevel === 'none') {
|
1889
1889
|
return undefined;
|
1890
1890
|
}
|
1891
|
-
const diagnostic = addDiagnosticWithSuppressionCheck(diagLevel, message, node);
|
1891
|
+
const diagnostic = addDiagnosticWithSuppressionCheck(diagLevel, message, node, range);
|
1892
1892
|
if (diagnostic) {
|
1893
1893
|
diagnostic.setRule(rule);
|
1894
1894
|
}
|
@@ -1917,6 +1917,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
1917
1917
|
addDiagnostic(fileInfo.diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.Localizer.Diagnostic.typeExpectedClass().format({ type: printType(type) }) + diag.getString(), node);
|
1918
1918
|
}
|
1919
1919
|
function assignTypeToNameNode(nameNode, type, isTypeIncomplete, ignoreEmptyContainers, srcExpression, allowAssignmentToFinalVar = false, expectedTypeDiagAddendum) {
|
1920
|
+
var _a, _b;
|
1920
1921
|
const nameValue = nameNode.value;
|
1921
1922
|
const symbolWithScope = lookUpSymbolRecursive(nameNode, nameValue, /* honorCodeFlow */ false);
|
1922
1923
|
if (!symbolWithScope) {
|
@@ -1954,7 +1955,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
1954
1955
|
addDiagnostic(fileInfo.diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.Localizer.Diagnostic.typeAssignmentMismatch().format({
|
1955
1956
|
sourceType: printType(type),
|
1956
1957
|
destType: printType(declaredType),
|
1957
|
-
}) + diagAddendum.getString(), srcExpression !== null && srcExpression !== void 0 ? srcExpression : nameNode);
|
1958
|
+
}) + diagAddendum.getString(), srcExpression !== null && srcExpression !== void 0 ? srcExpression : nameNode, (_b = (_a = diagAddendum.getEffectiveTextRange()) !== null && _a !== void 0 ? _a : srcExpression) !== null && _b !== void 0 ? _b : nameNode);
|
1958
1959
|
// Replace the assigned type with the (unnarrowed) declared type.
|
1959
1960
|
destType = declaredType;
|
1960
1961
|
}
|
@@ -2856,7 +2857,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2856
2857
|
// cannot be used in this location.
|
2857
2858
|
function validateTypeVarUsage(node, type, flags) {
|
2858
2859
|
var _a;
|
2859
|
-
if (types_1.TypeBase.isInstantiable(type) && !(0, typeUtils_1.isTypeAliasPlaceholder)(type)) {
|
2860
|
+
if (types_1.TypeBase.isInstantiable(type) && !type.scopeId && !(0, typeUtils_1.isTypeAliasPlaceholder)(type)) {
|
2860
2861
|
const scopedTypeVarInfo = findScopedTypeVar(node, type);
|
2861
2862
|
type = scopedTypeVarInfo.type;
|
2862
2863
|
if ((flags & 2048 /* DisallowTypeVarsWithScopeId */) !== 0 && type.scopeId !== undefined) {
|
@@ -3145,7 +3146,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3145
3146
|
return typeResult;
|
3146
3147
|
}
|
3147
3148
|
function getTypeOfMemberAccessWithBaseType(node, baseTypeResult, usage, flags) {
|
3148
|
-
var _a;
|
3149
|
+
var _a, _b;
|
3149
3150
|
let baseType = baseTypeResult.type;
|
3150
3151
|
const memberName = node.memberName.value;
|
3151
3152
|
let diag = new diagnostic_1.DiagnosticAddendum();
|
@@ -3239,12 +3240,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3239
3240
|
}
|
3240
3241
|
}
|
3241
3242
|
else {
|
3242
|
-
// Handle the special case of LiteralString.
|
3243
|
-
if (types_1.ClassType.isBuiltIn(baseType, 'LiteralString') &&
|
3244
|
-
strClassType &&
|
3245
|
-
(0, types_1.isInstantiableClass)(strClassType)) {
|
3246
|
-
baseType = types_1.ClassType.cloneAsInstance(strClassType);
|
3247
|
-
}
|
3248
3243
|
// Handle the special case of 'name' and 'value' members within an enum.
|
3249
3244
|
const enumMemberResult = (0, enums_1.getTypeOfEnumMember)(evaluatorInterface, node, baseType, memberName, isIncomplete);
|
3250
3245
|
if (enumMemberResult) {
|
@@ -3421,7 +3416,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3421
3416
|
const [ruleSet, rule] = isFunctionRule
|
3422
3417
|
? [fileInfo.diagnosticRuleSet.reportFunctionMemberAccess, diagnosticRules_1.DiagnosticRule.reportFunctionMemberAccess]
|
3423
3418
|
: [fileInfo.diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues];
|
3424
|
-
addDiagnostic(ruleSet, rule, diagMessage.format({ name: memberName, type: printType(baseType) }) + diag.getString(), node.memberName);
|
3419
|
+
addDiagnostic(ruleSet, rule, diagMessage.format({ name: memberName, type: printType(baseType) }) + diag.getString(), node.memberName, (_a = diag.getEffectiveTextRange()) !== null && _a !== void 0 ? _a : node.memberName);
|
3425
3420
|
}
|
3426
3421
|
// If this is member access on a function, use "Any" so if the
|
3427
3422
|
// reportFunctionMemberAccess rule is disabled, we don't trigger
|
@@ -3442,7 +3437,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3442
3437
|
// It can also come up in cases like "isinstance(x, (list, dict))".
|
3443
3438
|
if ((0, types_1.isInstantiableClass)(type)) {
|
3444
3439
|
const argNode = ParseTreeUtils.getParentNodeOfType(node, 1 /* Argument */);
|
3445
|
-
if (argNode && ((
|
3440
|
+
if (argNode && ((_b = argNode === null || argNode === void 0 ? void 0 : argNode.parent) === null || _b === void 0 ? void 0 : _b.nodeType) === 9 /* Call */) {
|
3446
3441
|
skipPartialUnknownCheck = true;
|
3447
3442
|
}
|
3448
3443
|
}
|
@@ -4951,7 +4946,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
4951
4946
|
return { type: types_1.UnknownType.create(/* isIncomplete */ true), isIncomplete: true };
|
4952
4947
|
}
|
4953
4948
|
const assertedType = (0, typeUtils_1.convertToInstance)(getTypeOfArgumentExpectingType(node.arguments[1]).type);
|
4954
|
-
if (!(0, types_1.isTypeSame)(assertedType, arg0TypeResult.type)) {
|
4949
|
+
if (!(0, types_1.isTypeSame)(assertedType, arg0TypeResult.type, { treatAnySameAsUnknown: true })) {
|
4955
4950
|
addDiagnostic(AnalyzerNodeInfo.getFileInfo(node).diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.Localizer.Diagnostic.assertTypeTypeMismatch().format({
|
4956
4951
|
expected: printType(assertedType),
|
4957
4952
|
received: printType(arg0TypeResult.type),
|
@@ -5442,7 +5437,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5442
5437
|
// Is this a union type? If so, we can expand it.
|
5443
5438
|
const argType = contextFreeArgTypes[indexToExpand];
|
5444
5439
|
if ((0, types_1.isUnion)(argType)) {
|
5445
|
-
unionToExpand = argType;
|
5440
|
+
unionToExpand = makeTopLevelTypeVarsConcrete(argType);
|
5441
|
+
break;
|
5442
|
+
}
|
5443
|
+
else if ((0, types_1.isTypeVar)(argType) && argType.details.constraints.length > 1) {
|
5444
|
+
unionToExpand = makeTopLevelTypeVarsConcrete(argType);
|
5446
5445
|
break;
|
5447
5446
|
}
|
5448
5447
|
indexToExpand++;
|
@@ -5855,8 +5854,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5855
5854
|
const castToType = getTypeOfArgumentExpectingType(argList[0]).type;
|
5856
5855
|
const castFromType = getTypeOfArgument(argList[1]).type;
|
5857
5856
|
if ((0, types_1.isInstantiableClass)(castToType) && (0, types_1.isClassInstance)(castFromType)) {
|
5858
|
-
if ((0, types_1.isTypeSame)(castToType, types_1.ClassType.cloneAsInstantiable(castFromType),
|
5859
|
-
|
5857
|
+
if ((0, types_1.isTypeSame)(castToType, types_1.ClassType.cloneAsInstantiable(castFromType), {
|
5858
|
+
ignorePseudoGeneric: true,
|
5859
|
+
})) {
|
5860
5860
|
addDiagnostic(AnalyzerNodeInfo.getFileInfo(errorNode).diagnosticRuleSet.reportUnnecessaryCast, diagnosticRules_1.DiagnosticRule.reportUnnecessaryCast, localize_1.Localizer.Diagnostic.unnecessaryCast().format({
|
5861
5861
|
type: printType(castFromType),
|
5862
5862
|
}), errorNode);
|
@@ -6891,7 +6891,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
6891
6891
|
type.strippedFirstParamType.typeArguments.forEach((typeArg, index) => {
|
6892
6892
|
if (index < typeParams.length) {
|
6893
6893
|
const typeParam = typeParams[index];
|
6894
|
-
if (!(0, types_1.isTypeSame)(typeParam, typeArg,
|
6894
|
+
if (!(0, types_1.isTypeSame)(typeParam, typeArg, { ignorePseudoGeneric: true })) {
|
6895
6895
|
typeVarContext.setTypeVarType(typeParams[index], typeArg);
|
6896
6896
|
}
|
6897
6897
|
}
|
@@ -7208,6 +7208,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7208
7208
|
return !reportedArgError;
|
7209
7209
|
}
|
7210
7210
|
function validateArgType(argParam, typeVarContext, functionType, skipUnknownCheck, skipOverloadArg, useNarrowBoundOnly, conditionFilter) {
|
7211
|
+
var _a;
|
7211
7212
|
let argType;
|
7212
7213
|
let expectedTypeDiag;
|
7213
7214
|
let isTypeIncomplete = false;
|
@@ -7381,7 +7382,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7381
7382
|
if (expectedTypeDiag) {
|
7382
7383
|
diag = expectedTypeDiag;
|
7383
7384
|
}
|
7384
|
-
addDiagnostic(fileInfo.diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, message + diag.getString(), argParam.errorNode);
|
7385
|
+
addDiagnostic(fileInfo.diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, message + diag.getString(), argParam.errorNode, (_a = diag.getEffectiveTextRange()) !== null && _a !== void 0 ? _a : argParam.errorNode);
|
7385
7386
|
}
|
7386
7387
|
return { isCompatible: false, argType, isTypeIncomplete, condition };
|
7387
7388
|
}
|
@@ -7677,7 +7678,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7677
7678
|
/* declaredMetaclass */ undefined, arg1Type.details.effectiveMetaclass);
|
7678
7679
|
arg1Type.tupleTypeArguments.forEach((typeArg) => {
|
7679
7680
|
const specializedType = makeTopLevelTypeVarsConcrete(typeArg.type);
|
7680
|
-
if ((0, types_1.isInstantiableClass)(specializedType) ||
|
7681
|
+
if ((0, types_1.isInstantiableClass)(specializedType) ||
|
7682
|
+
(0, types_1.isAnyOrUnknown)(specializedType) ||
|
7683
|
+
((0, types_1.isClassInstance)(specializedType) && types_1.ClassType.isBuiltIn(specializedType, 'type'))) {
|
7681
7684
|
classType.details.baseClasses.push(specializedType);
|
7682
7685
|
}
|
7683
7686
|
else {
|
@@ -8349,12 +8352,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8349
8352
|
if ((0, types_1.isAnyOrUnknown)(subtype)) {
|
8350
8353
|
return subtype;
|
8351
8354
|
}
|
8352
|
-
if ((0, types_1.isClassInstance)(subtype) &&
|
8353
|
-
types_1.ClassType.isBuiltIn(subtype, 'LiteralString') &&
|
8354
|
-
strClassType &&
|
8355
|
-
(0, types_1.isInstantiableClass)(strClassType)) {
|
8356
|
-
return handleSubtype(types_1.ClassType.cloneAsInstance(strClassType));
|
8357
|
-
}
|
8358
8355
|
if ((0, types_1.isClassInstance)(subtype) || (0, types_1.isInstantiableClass)(subtype) || (0, types_1.isTypeVar)(subtype)) {
|
8359
8356
|
return handleSubtype(subtype);
|
8360
8357
|
}
|
@@ -8440,7 +8437,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8440
8437
|
isIncomplete = true;
|
8441
8438
|
}
|
8442
8439
|
if (types_1.ClassType.isTypedDictClass(expectedType)) {
|
8443
|
-
const resultTypedDict = (0, typedDicts_1.assignToTypedDict)(evaluatorInterface, expectedType, keyTypes, valueTypes,
|
8440
|
+
const resultTypedDict = (0, typedDicts_1.assignToTypedDict)(evaluatorInterface, expectedType, keyTypes, valueTypes,
|
8441
|
+
// Don't overwrite existing expectedDiagAddendum messages if they were
|
8442
|
+
// already provided by getKeyValueTypesFromDictionary.
|
8443
|
+
(expectedDiagAddendum === null || expectedDiagAddendum === void 0 ? void 0 : expectedDiagAddendum.isEmpty()) ? expectedDiagAddendum : undefined);
|
8444
8444
|
if (resultTypedDict) {
|
8445
8445
|
return {
|
8446
8446
|
type: resultTypedDict,
|
@@ -8474,8 +8474,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8474
8474
|
// and Iterable use covariant value types, so they can be narrowed.
|
8475
8475
|
const isValueTypeInvariant = (0, types_1.isClassInstance)(expectedType) &&
|
8476
8476
|
(types_1.ClassType.isBuiltIn(expectedType, 'dict') || types_1.ClassType.isBuiltIn(expectedType, 'MutableMapping'));
|
8477
|
-
const specializedKeyType = inferTypeArgFromExpectedType(expectedKeyType, keyTypes
|
8478
|
-
|
8477
|
+
const specializedKeyType = inferTypeArgFromExpectedType(expectedKeyType, keyTypes.map((result) => result.type),
|
8478
|
+
/* isNarrowable */ false);
|
8479
|
+
const specializedValueType = inferTypeArgFromExpectedType(expectedValueType, valueTypes.map((result) => result.type),
|
8479
8480
|
/* isNarrowable */ !isValueTypeInvariant);
|
8480
8481
|
if (!specializedKeyType || !specializedValueType) {
|
8481
8482
|
return undefined;
|
@@ -8489,17 +8490,18 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8489
8490
|
const fallbackType = hasExpectedType ? types_1.AnyType.create() : types_1.UnknownType.create();
|
8490
8491
|
let keyType = fallbackType;
|
8491
8492
|
let valueType = fallbackType;
|
8492
|
-
|
8493
|
-
|
8493
|
+
const keyTypeResults = [];
|
8494
|
+
const valueTypeResults = [];
|
8494
8495
|
let isEmptyContainer = false;
|
8495
8496
|
let isIncomplete = false;
|
8496
8497
|
// Infer the key and value types if possible.
|
8497
|
-
if (getKeyAndValueTypesFromDictionary(node,
|
8498
|
+
if (getKeyAndValueTypesFromDictionary(node, keyTypeResults, valueTypeResults,
|
8499
|
+
/* forceStrictInference */ hasExpectedType)) {
|
8498
8500
|
isIncomplete = true;
|
8499
8501
|
}
|
8500
8502
|
// Strip any literal values.
|
8501
|
-
keyTypes =
|
8502
|
-
valueTypes =
|
8503
|
+
const keyTypes = keyTypeResults.map((t) => stripLiteralValue(t.type));
|
8504
|
+
const valueTypes = valueTypeResults.map((t) => stripLiteralValue(t.type));
|
8503
8505
|
keyType = keyTypes.length > 0 ? (0, types_1.combineTypes)(keyTypes) : fallbackType;
|
8504
8506
|
// If the value type differs and we're not using "strict inference mode",
|
8505
8507
|
// we need to back off because we can't properly represent the mappings
|
@@ -8511,7 +8513,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8511
8513
|
valueType = (0, types_1.combineTypes)(valueTypes);
|
8512
8514
|
}
|
8513
8515
|
else {
|
8514
|
-
valueType = (0, typeUtils_1.areTypesSame)(valueTypes,
|
8516
|
+
valueType = (0, typeUtils_1.areTypesSame)(valueTypes, { ignorePseudoGeneric: true }) ? valueTypes[0] : fallbackType;
|
8515
8517
|
}
|
8516
8518
|
}
|
8517
8519
|
else {
|
@@ -8561,8 +8563,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8561
8563
|
isIncomplete = true;
|
8562
8564
|
}
|
8563
8565
|
if (forceStrictInference || index < maxEntriesToUseForInference) {
|
8564
|
-
keyTypes.push(keyType);
|
8565
|
-
valueTypes.push(valueType);
|
8566
|
+
keyTypes.push({ node: entryNode.keyExpression, type: keyType });
|
8567
|
+
valueTypes.push({ node: entryNode.valueExpression, type: valueType });
|
8566
8568
|
}
|
8567
8569
|
addUnknown = false;
|
8568
8570
|
}
|
@@ -8575,6 +8577,21 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8575
8577
|
if ((0, types_1.isAnyOrUnknown)(unexpandedType)) {
|
8576
8578
|
addUnknown = false;
|
8577
8579
|
}
|
8580
|
+
else if ((0, types_1.isClassInstance)(unexpandedType) && types_1.ClassType.isTypedDictClass(unexpandedType)) {
|
8581
|
+
// Handle dictionary expansion for a TypedDict.
|
8582
|
+
if (strClassType && (0, types_1.isInstantiableClass)(strClassType)) {
|
8583
|
+
const strObject = types_1.ClassType.cloneAsInstance(strClassType);
|
8584
|
+
const tdEntries = (0, typedDicts_1.getTypedDictMembersForClass)(evaluatorInterface, unexpandedType,
|
8585
|
+
/* allowNarrowed */ true);
|
8586
|
+
tdEntries.forEach((entry, name) => {
|
8587
|
+
if (entry.isRequired || entry.isProvided) {
|
8588
|
+
keyTypes.push({ node: entryNode, type: types_1.ClassType.cloneWithLiteral(strObject, name) });
|
8589
|
+
valueTypes.push({ node: entryNode, type: entry.valueType });
|
8590
|
+
}
|
8591
|
+
});
|
8592
|
+
addUnknown = false;
|
8593
|
+
}
|
8594
|
+
}
|
8578
8595
|
else {
|
8579
8596
|
// Verify that the type supports the `keys` and `__getitem__` methods.
|
8580
8597
|
// This protocol is defined in the _typeshed stub. If we can't find
|
@@ -8594,8 +8611,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8594
8611
|
const typeArgs = specializedMapping.typeArguments;
|
8595
8612
|
if (typeArgs && typeArgs.length >= 2) {
|
8596
8613
|
if (forceStrictInference || index < maxEntriesToUseForInference) {
|
8597
|
-
keyTypes.push(typeArgs[0]);
|
8598
|
-
valueTypes.push(typeArgs[1]);
|
8614
|
+
keyTypes.push({ node: entryNode, type: typeArgs[0] });
|
8615
|
+
valueTypes.push({ node: entryNode, type: typeArgs[1] });
|
8599
8616
|
}
|
8600
8617
|
addUnknown = false;
|
8601
8618
|
}
|
@@ -8618,8 +8635,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8618
8635
|
const typeArgs = (_a = dictEntryType.tupleTypeArguments) === null || _a === void 0 ? void 0 : _a.map((t) => t.type);
|
8619
8636
|
if (typeArgs && typeArgs.length === 2) {
|
8620
8637
|
if (forceStrictInference || index < maxEntriesToUseForInference) {
|
8621
|
-
keyTypes.push(typeArgs[0]);
|
8622
|
-
valueTypes.push(typeArgs[1]);
|
8638
|
+
keyTypes.push({ node: entryNode, type: typeArgs[0] });
|
8639
|
+
valueTypes.push({ node: entryNode, type: typeArgs[1] });
|
8623
8640
|
}
|
8624
8641
|
addUnknown = false;
|
8625
8642
|
}
|
@@ -8627,8 +8644,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8627
8644
|
}
|
8628
8645
|
if (addUnknown) {
|
8629
8646
|
if (forceStrictInference || index < maxEntriesToUseForInference) {
|
8630
|
-
keyTypes.push(types_1.UnknownType.create());
|
8631
|
-
valueTypes.push(types_1.UnknownType.create());
|
8647
|
+
keyTypes.push({ node: entryNode, type: types_1.UnknownType.create() });
|
8648
|
+
valueTypes.push({ node: entryNode, type: types_1.UnknownType.create() });
|
8632
8649
|
}
|
8633
8650
|
}
|
8634
8651
|
});
|
@@ -8666,6 +8683,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8666
8683
|
const builtInClassName = node.nodeType === 31 /* List */ ? 'list' : 'set';
|
8667
8684
|
expectedType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(expectedType);
|
8668
8685
|
let isIncomplete = false;
|
8686
|
+
let typeErrors = false;
|
8669
8687
|
if (!(0, types_1.isClassInstance)(expectedType)) {
|
8670
8688
|
return undefined;
|
8671
8689
|
}
|
@@ -8695,6 +8713,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8695
8713
|
if (entryTypeResult.isIncomplete) {
|
8696
8714
|
isIncomplete = true;
|
8697
8715
|
}
|
8716
|
+
if (entryTypeResult.typeErrors) {
|
8717
|
+
typeErrors = true;
|
8718
|
+
}
|
8698
8719
|
});
|
8699
8720
|
const isExpectedTypeListOrSet = (0, types_1.isClassInstance)(expectedType) && types_1.ClassType.isBuiltIn(expectedType, builtInClassName);
|
8700
8721
|
const specializedEntryType = inferTypeArgFromExpectedType(expectedEntryType, entryTypes,
|
@@ -8703,13 +8724,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8703
8724
|
return undefined;
|
8704
8725
|
}
|
8705
8726
|
const type = getBuiltInObject(node, builtInClassName, [specializedEntryType]);
|
8706
|
-
return { type, isIncomplete };
|
8727
|
+
return { type, isIncomplete, typeErrors };
|
8707
8728
|
}
|
8708
8729
|
// Attempts to infer the type of a list or set statement with no "expected type".
|
8709
8730
|
function getTypeOfListOrSetInferred(node, hasExpectedType) {
|
8710
8731
|
const builtInClassName = node.nodeType === 31 /* List */ ? 'list' : 'set';
|
8711
8732
|
let isEmptyContainer = false;
|
8712
8733
|
let isIncomplete = false;
|
8734
|
+
let typeErrors = false;
|
8713
8735
|
let entryTypes = [];
|
8714
8736
|
node.entries.forEach((entry, index) => {
|
8715
8737
|
let entryTypeResult;
|
@@ -8723,6 +8745,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8723
8745
|
if (entryTypeResult.isIncomplete) {
|
8724
8746
|
isIncomplete = true;
|
8725
8747
|
}
|
8748
|
+
if (entryTypeResult.typeErrors) {
|
8749
|
+
typeErrors = true;
|
8750
|
+
}
|
8726
8751
|
if (index < maxEntriesToUseForInference) {
|
8727
8752
|
entryTypes.push(entryTypeResult.type);
|
8728
8753
|
}
|
@@ -8740,7 +8765,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8740
8765
|
}
|
8741
8766
|
else {
|
8742
8767
|
// Is the list or set homogeneous? If so, use stricter rules. Otherwise relax the rules.
|
8743
|
-
inferredEntryType = (0, typeUtils_1.areTypesSame)(entryTypes,
|
8768
|
+
inferredEntryType = (0, typeUtils_1.areTypesSame)(entryTypes, { ignorePseudoGeneric: true })
|
8744
8769
|
? entryTypes[0]
|
8745
8770
|
: inferredEntryType;
|
8746
8771
|
}
|
@@ -8755,7 +8780,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8755
8780
|
/* includeSubclasses */ undefined,
|
8756
8781
|
/* TupleTypeArguments */ undefined, isEmptyContainer))
|
8757
8782
|
: types_1.UnknownType.create();
|
8758
|
-
return { type, isIncomplete };
|
8783
|
+
return { type, isIncomplete, typeErrors };
|
8759
8784
|
}
|
8760
8785
|
function inferTypeArgFromExpectedType(expectedType, entryTypes, isNarrowable) {
|
8761
8786
|
let targetTypeVar;
|
@@ -8803,12 +8828,16 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8803
8828
|
getTypeOfExpression(node.testExpression);
|
8804
8829
|
const typesToCombine = [];
|
8805
8830
|
let isIncomplete = false;
|
8831
|
+
let typeErrors = false;
|
8806
8832
|
if (isNodeReachable(node.ifExpression)) {
|
8807
8833
|
const ifType = getTypeOfExpression(node.ifExpression, flags, expectedType);
|
8808
8834
|
typesToCombine.push(ifType.type);
|
8809
8835
|
if (ifType.isIncomplete) {
|
8810
8836
|
isIncomplete = true;
|
8811
8837
|
}
|
8838
|
+
if (ifType.typeErrors) {
|
8839
|
+
typeErrors = true;
|
8840
|
+
}
|
8812
8841
|
}
|
8813
8842
|
if (isNodeReachable(node.elseExpression)) {
|
8814
8843
|
const elseType = getTypeOfExpression(node.elseExpression, flags, expectedType);
|
@@ -8816,8 +8845,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8816
8845
|
if (elseType.isIncomplete) {
|
8817
8846
|
isIncomplete = true;
|
8818
8847
|
}
|
8848
|
+
if (elseType.typeErrors) {
|
8849
|
+
typeErrors = true;
|
8850
|
+
}
|
8819
8851
|
}
|
8820
|
-
return { type: (0, types_1.combineTypes)(typesToCombine), isIncomplete };
|
8852
|
+
return { type: (0, types_1.combineTypes)(typesToCombine), isIncomplete, typeErrors };
|
8821
8853
|
}
|
8822
8854
|
function getTypeOfYield(node) {
|
8823
8855
|
let expectedYieldType;
|
@@ -8993,10 +9025,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8993
9025
|
}
|
8994
9026
|
function getTypeOfListComprehension(node, expectedType) {
|
8995
9027
|
let isIncomplete = false;
|
9028
|
+
let typeErrors = false;
|
8996
9029
|
const elementTypeResult = getElementTypeFromListComprehension(node);
|
8997
9030
|
if (elementTypeResult.isIncomplete) {
|
8998
9031
|
isIncomplete = true;
|
8999
9032
|
}
|
9033
|
+
if (elementTypeResult.typeErrors) {
|
9034
|
+
typeErrors = true;
|
9035
|
+
}
|
9000
9036
|
const elementType = elementTypeResult.type;
|
9001
9037
|
let isAsync = node.forIfNodes.some((comp) => {
|
9002
9038
|
return ((comp.nodeType === 33 /* ListComprehensionFor */ && comp.isAsync) ||
|
@@ -9022,7 +9058,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
9022
9058
|
: [elementType, types_1.NoneType.createInstance(), types_1.NoneType.createInstance()],
|
9023
9059
|
/* isTypeArgumentExplicit */ true));
|
9024
9060
|
}
|
9025
|
-
return { type, isIncomplete };
|
9061
|
+
return { type, isIncomplete, typeErrors };
|
9026
9062
|
}
|
9027
9063
|
function reportPossibleUnknownAssignment(diagLevel, rule, target, type, errorNode, ignoreEmptyContainers) {
|
9028
9064
|
// Don't bother if the feature is disabled.
|
@@ -9079,6 +9115,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
9079
9115
|
// as opposed to the entire list.
|
9080
9116
|
function getElementTypeFromListComprehension(node, expectedValueOrElementType, expectedKeyType) {
|
9081
9117
|
let isIncomplete = false;
|
9118
|
+
let typeErrors = false;
|
9082
9119
|
// "Execute" the list comprehensions from start to finish.
|
9083
9120
|
for (const forIfNode of node.forIfNodes) {
|
9084
9121
|
if (evaluateListComprehensionForIf(forIfNode)) {
|
@@ -9093,6 +9130,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
9093
9130
|
if (keyTypeResult.isIncomplete) {
|
9094
9131
|
isIncomplete = true;
|
9095
9132
|
}
|
9133
|
+
if (keyTypeResult.typeErrors) {
|
9134
|
+
typeErrors = true;
|
9135
|
+
}
|
9096
9136
|
let keyType = keyTypeResult.type;
|
9097
9137
|
if (!expectedKeyType || !(0, typeUtils_1.containsLiteralType)(expectedKeyType)) {
|
9098
9138
|
keyType = stripLiteralValue(keyType);
|
@@ -9102,6 +9142,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
9102
9142
|
if (valueTypeResult.isIncomplete) {
|
9103
9143
|
isIncomplete = true;
|
9104
9144
|
}
|
9145
|
+
if (valueTypeResult.typeErrors) {
|
9146
|
+
typeErrors = true;
|
9147
|
+
}
|
9105
9148
|
let valueType = valueTypeResult.type;
|
9106
9149
|
if (!expectedValueOrElementType || !(0, typeUtils_1.containsLiteralType)(expectedValueOrElementType)) {
|
9107
9150
|
valueType = stripLiteralValue(valueType);
|
@@ -9118,9 +9161,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
9118
9161
|
if (exprTypeResult.isIncomplete) {
|
9119
9162
|
isIncomplete = true;
|
9120
9163
|
}
|
9164
|
+
if (exprTypeResult.typeErrors) {
|
9165
|
+
typeErrors = true;
|
9166
|
+
}
|
9121
9167
|
type = exprTypeResult.type;
|
9122
9168
|
}
|
9123
|
-
return { type, isIncomplete };
|
9169
|
+
return { type, isIncomplete, typeErrors };
|
9124
9170
|
}
|
9125
9171
|
function getTypeOfSlice(node) {
|
9126
9172
|
// Evaluate the expressions to report errors and record symbol
|
@@ -9972,6 +10018,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
9972
10018
|
return cachedType;
|
9973
10019
|
}
|
9974
10020
|
const specialType = createSpecialBuiltInClass(node, assignedName, aliasMapEntry);
|
10021
|
+
// Handle 'LiteralString' specially because we want it to act as
|
10022
|
+
// though it derives from 'str'.
|
10023
|
+
if (assignedName === 'LiteralString') {
|
10024
|
+
specialType.details.baseClasses.push(strClassType !== null && strClassType !== void 0 ? strClassType : types_1.AnyType.create());
|
10025
|
+
(0, typeUtils_1.computeMroLinearization)(specialType);
|
10026
|
+
}
|
9975
10027
|
writeTypeCache(node, specialType, 0 /* None */, /* isIncomplete */ false);
|
9976
10028
|
return specialType;
|
9977
10029
|
}
|
@@ -11810,7 +11862,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
11810
11862
|
isIncomplete = true;
|
11811
11863
|
}
|
11812
11864
|
else {
|
11813
|
-
functionRecursionMap.
|
11865
|
+
functionRecursionMap.add(node.id);
|
11814
11866
|
try {
|
11815
11867
|
let functionDecl;
|
11816
11868
|
const decl = AnalyzerNodeInfo.getDeclaration(node);
|
@@ -14906,9 +14958,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
14906
14958
|
(0, typeUtils_1.isTupleClass)(srcType) &&
|
14907
14959
|
srcType.tupleTypeArguments &&
|
14908
14960
|
srcType.tupleTypeArguments.length === 1) {
|
14909
|
-
if ((0, types_1.isTypeSame)(destType, srcType.tupleTypeArguments[0].type,
|
14910
|
-
/* ignorePseudoGeneric */ undefined,
|
14911
|
-
/* ignoreTypeFlags */ undefined, recursionCount)) {
|
14961
|
+
if ((0, types_1.isTypeSame)(destType, srcType.tupleTypeArguments[0].type, {}, recursionCount)) {
|
14912
14962
|
return true;
|
14913
14963
|
}
|
14914
14964
|
}
|
@@ -15306,9 +15356,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15306
15356
|
function assignFromUnionType(destType, srcType, diag, destTypeVarContext, srcTypeVarContext, flags, recursionCount) {
|
15307
15357
|
// Start by checking for an exact match. This is needed to handle unions
|
15308
15358
|
// that contain recursive type aliases.
|
15309
|
-
if ((0, types_1.isTypeSame)(srcType, destType,
|
15310
|
-
/* ignorePseudoGeneric */ undefined,
|
15311
|
-
/* ignoreTypeFlags */ undefined, recursionCount)) {
|
15359
|
+
if ((0, types_1.isTypeSame)(srcType, destType, {}, recursionCount)) {
|
15312
15360
|
return true;
|
15313
15361
|
}
|
15314
15362
|
// Handle the case where the source and dest are both unions. Try
|
@@ -15337,9 +15385,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15337
15385
|
remainingDestSubtypes.push(destSubtype);
|
15338
15386
|
}
|
15339
15387
|
else {
|
15340
|
-
const srcTypeIndex = remainingSrcSubtypes.findIndex((srcSubtype) => (0, types_1.isTypeSame)(srcSubtype, destSubtype,
|
15341
|
-
/* ignorePseudoGeneric */ undefined,
|
15342
|
-
/* ignoreTypeFlags */ undefined, recursionCount));
|
15388
|
+
const srcTypeIndex = remainingSrcSubtypes.findIndex((srcSubtype) => (0, types_1.isTypeSame)(srcSubtype, destSubtype, {}, recursionCount));
|
15343
15389
|
if (srcTypeIndex >= 0) {
|
15344
15390
|
remainingSrcSubtypes.splice(srcTypeIndex, 1);
|
15345
15391
|
}
|
@@ -15351,11 +15397,21 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15351
15397
|
// For all remaining source subtypes, attempt to find a dest subtype
|
15352
15398
|
// whose primary type matches.
|
15353
15399
|
if (!isIncompatible) {
|
15354
|
-
|
15355
|
-
const destTypeIndex = remainingDestSubtypes.findIndex((destSubtype) =>
|
15356
|
-
(0, types_1.isClass)(
|
15357
|
-
|
15358
|
-
|
15400
|
+
(0, typeUtils_1.sortTypes)(remainingSrcSubtypes).forEach((srcSubtype) => {
|
15401
|
+
const destTypeIndex = remainingDestSubtypes.findIndex((destSubtype) => {
|
15402
|
+
if ((0, types_1.isClass)(srcSubtype) &&
|
15403
|
+
(0, types_1.isClass)(destSubtype) &&
|
15404
|
+
types_1.TypeBase.isInstance(srcSubtype) === types_1.TypeBase.isInstance(destSubtype) &&
|
15405
|
+
types_1.ClassType.isSameGenericClass(srcSubtype, destSubtype)) {
|
15406
|
+
return true;
|
15407
|
+
}
|
15408
|
+
if ((0, types_1.isFunction)(srcSubtype) || (0, types_1.isOverloadedFunction)(srcSubtype)) {
|
15409
|
+
if ((0, types_1.isFunction)(destSubtype) || (0, types_1.isOverloadedFunction)(destSubtype)) {
|
15410
|
+
return true;
|
15411
|
+
}
|
15412
|
+
}
|
15413
|
+
return false;
|
15414
|
+
});
|
15359
15415
|
if (destTypeIndex >= 0) {
|
15360
15416
|
if (!assignType(remainingDestSubtypes[destTypeIndex], srcSubtype, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
|
15361
15417
|
isIncompatible = true;
|
@@ -15586,9 +15642,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15586
15642
|
// The srcType is assignable only if all of its subtypes are assignable.
|
15587
15643
|
return !(0, types_1.findSubtype)(srcType, (srcSubtype) => {
|
15588
15644
|
var _a;
|
15589
|
-
if ((0, types_1.isTypeSame)(destType, srcSubtype,
|
15590
|
-
/* ignorePseudoGeneric */ true,
|
15591
|
-
/* ignoreTypeFlags */ undefined, recursionCount)) {
|
15645
|
+
if ((0, types_1.isTypeSame)(destType, srcSubtype, { ignorePseudoGeneric: true }, recursionCount)) {
|
15592
15646
|
return false;
|
15593
15647
|
}
|
15594
15648
|
const destTypeVarName = types_1.TypeVarType.getNameWithScope(destType);
|
@@ -16264,9 +16318,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16264
16318
|
// If there are any remaining parameters or the source doesn't include the
|
16265
16319
|
// dest param spec itself, it is not assignable in this case.
|
16266
16320
|
if (!srcParamSpec ||
|
16267
|
-
!(0, types_1.isTypeSame)(srcParamSpec, destParamSpec,
|
16268
|
-
/* ignorePseudoGeneric */ false,
|
16269
|
-
/* ignoreTypeFlags */ true) ||
|
16321
|
+
!(0, types_1.isTypeSame)(srcParamSpec, destParamSpec, { ignoreTypeFlags: true }) ||
|
16270
16322
|
remainingParams.length > 0) {
|
16271
16323
|
canAssign = false;
|
16272
16324
|
}
|
@@ -16664,9 +16716,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16664
16716
|
}
|
16665
16717
|
let effectiveSrcType = srcType;
|
16666
16718
|
if ((0, types_1.isTypeVar)(srcType)) {
|
16667
|
-
if ((0, types_1.isTypeSame)(srcType, destType,
|
16668
|
-
/* ignorePseudoGeneric */ undefined,
|
16669
|
-
/* ignoreTypeFlags */ undefined, recursionCount)) {
|
16719
|
+
if ((0, types_1.isTypeSame)(srcType, destType, {}, recursionCount)) {
|
16670
16720
|
return srcType;
|
16671
16721
|
}
|
16672
16722
|
effectiveSrcType = makeTopLevelTypeVarsConcrete(srcType);
|
@@ -17005,6 +17055,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
17005
17055
|
removeFalsinessFromType,
|
17006
17056
|
verifyRaiseExceptionType,
|
17007
17057
|
verifyDeleteExpression,
|
17058
|
+
validateOverloadedFunctionArguments,
|
17008
17059
|
isAfterNodeReachable,
|
17009
17060
|
isNodeReachable,
|
17010
17061
|
isAsymmetricDescriptorAssignment,
|