@zzzen/pyright-internal 1.2.0-dev.20220918 → 1.2.0-dev.20220925
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/service.js +2 -2
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/tracePrinter.js +3 -2
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +61 -27
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +1 -0
- package/dist/analyzer/typeEvaluatorTypes.js +4 -0
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeEvaluatorWithTracker.d.ts +1 -2
- package/dist/analyzer/typeEvaluatorWithTracker.js +39 -103
- package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
- package/dist/analyzer/typeUtils.js +15 -7
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/common/logTracker.d.ts +1 -0
- package/dist/common/logTracker.js +4 -0
- package/dist/common/logTracker.js.map +1 -1
- package/dist/common/timing.d.ts +1 -1
- package/dist/common/timing.js +3 -3
- package/dist/common/timing.js.map +1 -1
- package/dist/languageService/completionProvider.js +1 -0
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +4 -0
- package/dist/localization/localize.js +1 -0
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +2 -1
- package/dist/parser/tokenizer.d.ts +1 -1
- package/dist/parser/tokenizer.js +39 -14
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/tokenizerTypes.d.ts +3 -1
- package/dist/parser/tokenizerTypes.js +2 -0
- package/dist/parser/tokenizerTypes.js.map +1 -1
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js +3 -0
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -1
- package/dist/tests/ipythonMode.test.js +47 -4
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/logger.test.d.ts +1 -0
- package/dist/tests/logger.test.js +99 -0
- package/dist/tests/logger.test.js.map +1 -0
- package/dist/tests/testUtils.d.ts +2 -1
- package/dist/tests/testUtils.js +2 -2
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +2 -2
- package/dist/tests/typeEvaluator2.test.js +4 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/package.json +1 -1
@@ -28,6 +28,7 @@ export declare const enum EvaluatorFlags {
|
|
28
28
|
DisallowTypeVarsWithScopeId = 2048,
|
29
29
|
DisallowTypeVarsWithoutScopeId = 4096,
|
30
30
|
AssociateTypeVarsWithCurrentScope = 8192,
|
31
|
+
EnforceTypeVarVarianceConsistency = 16384,
|
31
32
|
VariableTypeAnnotation = 32768,
|
32
33
|
DisallowRecursiveTypeAliasPlaceholder = 65536,
|
33
34
|
ClassVarDisallowed = 131072,
|
@@ -54,6 +54,10 @@ var EvaluatorFlags;
|
|
54
54
|
// associated with an outer scope should be associated with
|
55
55
|
// the containing function's scope.
|
56
56
|
EvaluatorFlags[EvaluatorFlags["AssociateTypeVarsWithCurrentScope"] = 8192] = "AssociateTypeVarsWithCurrentScope";
|
57
|
+
// When a new class-scoped TypeVar is used within a class
|
58
|
+
// declaration, make sure that it is not used to parameterize
|
59
|
+
// a base class whose TypeVar variance is inconsistent.
|
60
|
+
EvaluatorFlags[EvaluatorFlags["EnforceTypeVarVarianceConsistency"] = 16384] = "EnforceTypeVarVarianceConsistency";
|
57
61
|
// Used for PEP 526-style variable type annotations
|
58
62
|
EvaluatorFlags[EvaluatorFlags["VariableTypeAnnotation"] = 32768] = "VariableTypeAnnotation";
|
59
63
|
// Emit an error if an incomplete recursive type alias is
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"typeEvaluatorTypes.js","sourceRoot":"","sources":["../../../src/analyzer/typeEvaluatorTypes.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAyCH,gEAAgE;AAChE,kDAAkD;AACrC,QAAA,0BAA0B,GAAG,EAAE,CAAC;AAE7C,IAAkB,
|
1
|
+
{"version":3,"file":"typeEvaluatorTypes.js","sourceRoot":"","sources":["../../../src/analyzer/typeEvaluatorTypes.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAyCH,gEAAgE;AAChE,kDAAkD;AACrC,QAAA,0BAA0B,GAAG,EAAE,CAAC;AAE7C,IAAkB,cA0FjB;AA1FD,WAAkB,cAAc;IAC5B,mDAAQ,CAAA;IAER,uDAAuD;IACvD,mFAA6B,CAAA;IAE7B,0DAA0D;IAC1D,gEAAgE;IAChE,SAAS;IACT,yEAAwB,CAAA;IAExB,yDAAyD;IACzD,uFAA+B,CAAA;IAE/B,kCAAkC;IAClC,iGAAoC,CAAA;IAEpC,0CAA0C;IAC1C,0EAAwB,CAAA;IAExB,6CAA6C;IAC7C,kFAA4B,CAAA;IAE5B,qDAAqD;IACrD,4BAA4B;IAC5B,sEAAsB,CAAA;IAEtB,gDAAgD;IAChD,yFAA+B,CAAA;IAE/B,2DAA2D;IAC3D,6FAAiC,CAAA;IAEjC,2DAA2D;IAC3D,gDAAgD;IAChD,uFAA8B,CAAA;IAE9B,gEAAgE;IAChE,6DAA6D;IAC7D,qBAAqB;IACrB,4FAAiC,CAAA;IAEjC,8DAA8D;IAC9D,+BAA+B;IAC/B,oGAAqC,CAAA;IAErC,0DAA0D;IAC1D,+BAA+B;IAC/B,0GAAwC,CAAA;IAExC,yDAAyD;IACzD,2DAA2D;IAC3D,mCAAmC;IACnC,gHAA2C,CAAA;IAE3C,yDAAyD;IACzD,6DAA6D;IAC7D,uDAAuD;IACvD,iHAA2C,CAAA;IAE3C,mDAAmD;IACnD,2FAAgC,CAAA;IAEhC,yDAAyD;IACzD,wBAAwB;IACxB,yHAA+C,CAAA;IAE/C,6CAA6C;IAC7C,oFAA4B,CAAA;IAE5B,mEAAmE;IACnE,wFAA8B,CAAA;IAE9B,iEAAiE;IACjE,iCAAiC;IACjC,4FAAgC,CAAA;IAEhC,wDAAwD;IACxD,+EAAyB,CAAA;IAEzB,uDAAuD;IACvD,iHAA0C,CAAA;IAE1C,6DAA6D;IAC7D,2DAA2D;IAC3D,oDAAoD;IACpD,6GAAwC,CAAA;IAExC,yCAAyC;IACzC,6FAAgC,CAAA;AACpC,CAAC,EA1FiB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QA0F/B"}
|
@@ -2,5 +2,4 @@ import { LogTracker } from '../common/logTracker';
|
|
2
2
|
import { ImportLookup } from './analyzerFileInfo';
|
3
3
|
import { TracePrinter } from './tracePrinter';
|
4
4
|
import { EvaluatorOptions } from './typeEvaluator';
|
5
|
-
|
6
|
-
export declare function createTypeEvaluatorWithTracker(importLookup: ImportLookup, evaluatorOptions: EvaluatorOptions, logger: LogTracker, printer?: TracePrinter): TypeEvaluator;
|
5
|
+
export declare function createTypeEvaluatorWithTracker(importLookup: ImportLookup, evaluatorOptions: EvaluatorOptions, logger: LogTracker, printer?: TracePrinter): import("./typeEvaluatorTypes").TypeEvaluator;
|
@@ -12,115 +12,51 @@
|
|
12
12
|
*/
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
14
|
exports.createTypeEvaluatorWithTracker = void 0;
|
15
|
+
const console_1 = require("../common/console");
|
15
16
|
const core_1 = require("../common/core");
|
16
17
|
const timing_1 = require("../common/timing");
|
17
18
|
const typeEvaluator_1 = require("./typeEvaluator");
|
18
19
|
// We don't want to track calls from the type evaluator itself, but only entry points.
|
19
20
|
function createTypeEvaluatorWithTracker(importLookup, evaluatorOptions, logger, printer) {
|
20
|
-
|
21
|
-
|
21
|
+
function wrapWithLogger(func) {
|
22
|
+
// Only wrap the function if told to do so and the log level is high enough for it
|
23
|
+
// to actually log something.
|
24
|
+
if (evaluatorOptions.logCalls && logger.logLevel === console_1.LogLevel.Log) {
|
25
|
+
return (...args) => {
|
26
|
+
return logger.log(func.name, (s) => {
|
27
|
+
if (func.name === 'importLookup' && args.length > 0) {
|
28
|
+
// This is actually a filename, so special case it.
|
29
|
+
s.add(printer === null || printer === void 0 ? void 0 : printer.printFileOrModuleName(args[0]));
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
// Print all parameters.
|
33
|
+
args.forEach((a) => {
|
34
|
+
s.add(printer === null || printer === void 0 ? void 0 : printer.print(a));
|
35
|
+
});
|
36
|
+
}
|
37
|
+
return timing_1.timingStats.typeEvaluationTime.timeOperation(func, ...args);
|
38
|
+
}, evaluatorOptions.minimumLoggingThreshold,
|
39
|
+
/* logParsingPerf */ true);
|
40
|
+
};
|
41
|
+
}
|
42
|
+
else if (!(0, core_1.isDebugMode)()) {
|
43
|
+
return timing_1.timingStats.typeEvaluationTime.timeOperation.bind(timing_1.timingStats.typeEvaluationTime, func);
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
return func;
|
47
|
+
}
|
22
48
|
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
return importLookup(filePath);
|
35
|
-
}, evaluatorOptions.minimumLoggingThreshold, true)
|
36
|
-
: importLookup;
|
37
|
-
const typeEvaluator = (0, typeEvaluator_1.createTypeEvaluator)(lookup, evaluatorOptions);
|
38
|
-
const withTracker = {
|
39
|
-
runWithCancellationToken: typeEvaluator.runWithCancellationToken,
|
40
|
-
getType: (n) => run('getType', () => typeEvaluator.getType(n), n),
|
41
|
-
getTypeOfExpression: (n, f, e) => run('getTypeOfExpression', () => typeEvaluator.getTypeOfExpression(n, f, e), n),
|
42
|
-
getTypeOfAnnotation: typeEvaluator.getTypeOfAnnotation,
|
43
|
-
getTypeOfClass: (n) => run('getTypeOfClass', () => typeEvaluator.getTypeOfClass(n), n),
|
44
|
-
getTypeOfFunction: (n) => run('getTypeOfFunction', () => typeEvaluator.getTypeOfFunction(n), n),
|
45
|
-
getTypeOfExpressionExpectingType: typeEvaluator.getTypeOfExpressionExpectingType,
|
46
|
-
evaluateTypeForSubnode: typeEvaluator.evaluateTypeForSubnode,
|
47
|
-
evaluateTypesForStatement: (n) => run('evaluateTypesForStatement', () => typeEvaluator.evaluateTypesForStatement(n), n),
|
48
|
-
evaluateTypesForMatchStatement: typeEvaluator.evaluateTypesForMatchStatement,
|
49
|
-
evaluateTypesForCaseStatement: typeEvaluator.evaluateTypesForCaseStatement,
|
50
|
-
evaluateTypeOfParameter: typeEvaluator.evaluateTypeOfParameter,
|
51
|
-
canBeTruthy: typeEvaluator.canBeTruthy,
|
52
|
-
canBeFalsy: typeEvaluator.canBeFalsy,
|
53
|
-
stripLiteralValue: typeEvaluator.stripLiteralValue,
|
54
|
-
removeTruthinessFromType: typeEvaluator.removeTruthinessFromType,
|
55
|
-
removeFalsinessFromType: typeEvaluator.removeFalsinessFromType,
|
56
|
-
getExpectedType: (n) => run('getExpectedType', () => typeEvaluator.getExpectedType(n), n),
|
57
|
-
verifyRaiseExceptionType: (n) => run('verifyRaiseExceptionType', () => typeEvaluator.verifyRaiseExceptionType(n), n),
|
58
|
-
verifyDeleteExpression: (n) => run('verifyDeleteExpression', () => typeEvaluator.verifyDeleteExpression(n), n),
|
59
|
-
validateOverloadedFunctionArguments: typeEvaluator.validateOverloadedFunctionArguments,
|
60
|
-
isAfterNodeReachable: (n) => run('isAfterNodeReachable', () => typeEvaluator.isAfterNodeReachable(n), n),
|
61
|
-
isNodeReachable: (n, s) => run('isNodeReachable', () => typeEvaluator.isNodeReachable(n, s), n),
|
62
|
-
isAsymmetricDescriptorAssignment: typeEvaluator.isAsymmetricDescriptorAssignment,
|
63
|
-
suppressDiagnostics: (node, callback) => run('suppressDiagnostics', () => typeEvaluator.suppressDiagnostics(node, callback)),
|
64
|
-
getDeclarationsForStringNode: (n) => run('getDeclarationsForStringNode', () => typeEvaluator.getDeclarationsForStringNode(n), n),
|
65
|
-
getDeclarationsForNameNode: (n, s) => run('getDeclarationsForNameNode', () => typeEvaluator.getDeclarationsForNameNode(n, s), n),
|
66
|
-
getTypeForDeclaration: (n) => run('getTypeForDeclaration', () => typeEvaluator.getTypeForDeclaration(n), n),
|
67
|
-
resolveAliasDeclaration: (d, l, h) => run('resolveAliasDeclaration', () => typeEvaluator.resolveAliasDeclaration(d, l, h), d),
|
68
|
-
resolveAliasDeclarationWithInfo: (d, l, h) => run('resolveAliasDeclarationWithInfo', () => typeEvaluator.resolveAliasDeclarationWithInfo(d, l, h), d),
|
69
|
-
getTypeOfIterable: (t, a, e) => run('getTypeOfIterable', () => typeEvaluator.getTypeOfIterable(t, a, e), t),
|
70
|
-
getTypeOfIterator: (t, a, e) => run('getTypeOfIterator', () => typeEvaluator.getTypeOfIterator(t, a, e), t),
|
71
|
-
getGetterTypeFromProperty: (p, i) => run('getGetterTypeFromProperty', () => typeEvaluator.getGetterTypeFromProperty(p, i), p),
|
72
|
-
getTypeOfArgument: typeEvaluator.getTypeOfArgument,
|
73
|
-
markNamesAccessed: (n, a) => run('markNamesAccessed', () => typeEvaluator.markNamesAccessed(n, a), n),
|
74
|
-
getScopeIdForNode: typeEvaluator.getScopeIdForNode,
|
75
|
-
makeTopLevelTypeVarsConcrete: (t) => run('makeTopLevelTypeVarsConcrete', () => typeEvaluator.makeTopLevelTypeVarsConcrete(t), t),
|
76
|
-
mapSubtypesExpandTypeVars: typeEvaluator.mapSubtypesExpandTypeVars,
|
77
|
-
lookUpSymbolRecursive: typeEvaluator.lookUpSymbolRecursive,
|
78
|
-
getDeclaredTypeOfSymbol: typeEvaluator.getDeclaredTypeOfSymbol,
|
79
|
-
getEffectiveTypeOfSymbol: (s) => run('getEffectiveTypeOfSymbol', () => typeEvaluator.getEffectiveTypeOfSymbol(s), s),
|
80
|
-
getEffectiveTypeOfSymbolForUsage: (s, u, d) => run('getEffectiveTypeOfSymbolForUsage', () => typeEvaluator.getEffectiveTypeOfSymbolForUsage(s, u, d), s),
|
81
|
-
getInferredTypeOfDeclaration: typeEvaluator.getInferredTypeOfDeclaration,
|
82
|
-
getDeclaredTypeForExpression: typeEvaluator.getDeclaredTypeForExpression,
|
83
|
-
getFunctionDeclaredReturnType: (n) => run('getFunctionDeclaredReturnType', () => typeEvaluator.getFunctionDeclaredReturnType(n), n),
|
84
|
-
getFunctionInferredReturnType: (t, a) => run('getFunctionInferredReturnType', () => typeEvaluator.getFunctionInferredReturnType(t, a), t),
|
85
|
-
getBestOverloadForArguments: (e, t, a) => typeEvaluator.getBestOverloadForArguments(e, t, a),
|
86
|
-
getBuiltInType: (n, b) => run('getBuiltInType', () => typeEvaluator.getBuiltInType(n, b), n),
|
87
|
-
getTypeOfMember: (m) => run('getTypeOfMember', () => typeEvaluator.getTypeOfMember(m), m.symbol),
|
88
|
-
getTypeOfObjectMember: typeEvaluator.getTypeOfObjectMember,
|
89
|
-
getBoundMethod: typeEvaluator.getBoundMethod,
|
90
|
-
getTypeOfMagicMethodReturn: typeEvaluator.getTypeOfMagicMethodReturn,
|
91
|
-
bindFunctionToClassOrObject: typeEvaluator.bindFunctionToClassOrObject,
|
92
|
-
getCallSignatureInfo: (n, i, a) => run('getCallSignatureInfo', () => typeEvaluator.getCallSignatureInfo(n, i, a), n),
|
93
|
-
getAbstractMethods: (c) => run('getAbstractMethods', () => typeEvaluator.getAbstractMethods(c), c),
|
94
|
-
narrowConstrainedTypeVar: typeEvaluator.narrowConstrainedTypeVar,
|
95
|
-
assignType: (d, s, a, dc, sc, f, r) => run('assignType', () => typeEvaluator.assignType(d, s, a, dc, sc, f, r), d),
|
96
|
-
validateOverrideMethod: (b, o, d, e) => run('validateOverrideMethod', () => typeEvaluator.validateOverrideMethod(b, o, d, e), o),
|
97
|
-
assignTypeToExpression: typeEvaluator.assignTypeToExpression,
|
98
|
-
assignClassToSelf: typeEvaluator.assignClassToSelf,
|
99
|
-
getBuiltInObject: typeEvaluator.getBuiltInObject,
|
100
|
-
getTypedDictClassType: typeEvaluator.getTypedDictClassType,
|
101
|
-
getTupleClassType: typeEvaluator.getTupleClassType,
|
102
|
-
getObjectType: typeEvaluator.getObjectType,
|
103
|
-
getTypingType: typeEvaluator.getTypingType,
|
104
|
-
inferReturnTypeIfNecessary: typeEvaluator.inferReturnTypeIfNecessary,
|
105
|
-
inferTypeParameterVarianceForClass: typeEvaluator.inferTypeParameterVarianceForClass,
|
106
|
-
verifyTypeArgumentsAssignable: typeEvaluator.verifyTypeArgumentsAssignable,
|
107
|
-
addError: typeEvaluator.addError,
|
108
|
-
addWarning: typeEvaluator.addWarning,
|
109
|
-
addInformation: typeEvaluator.addInformation,
|
110
|
-
addUnusedCode: typeEvaluator.addUnusedCode,
|
111
|
-
addUnreachableCode: typeEvaluator.addUnreachableCode,
|
112
|
-
addDeprecated: typeEvaluator.addDeprecated,
|
113
|
-
addDiagnostic: typeEvaluator.addDiagnostic,
|
114
|
-
addDiagnosticForTextRange: typeEvaluator.addDiagnosticForTextRange,
|
115
|
-
printType: (t, e) => run('printType', () => typeEvaluator.printType(t, e), t),
|
116
|
-
printFunctionParts: (t) => run('printFunctionParts', () => typeEvaluator.printFunctionParts(t), t),
|
117
|
-
getTypeCacheEntryCount: typeEvaluator.getTypeCacheEntryCount,
|
118
|
-
disposeEvaluator: typeEvaluator.disposeEvaluator,
|
119
|
-
useSpeculativeMode: typeEvaluator.useSpeculativeMode,
|
120
|
-
setTypeForNode: typeEvaluator.setTypeForNode,
|
121
|
-
checkForCancellation: typeEvaluator.checkForCancellation,
|
122
|
-
};
|
123
|
-
return withTracker;
|
49
|
+
// Wrap all functions with either a logger or a timer.
|
50
|
+
importLookup = wrapWithLogger(importLookup);
|
51
|
+
const evaluator = (0, typeEvaluator_1.createTypeEvaluator)(importLookup, evaluatorOptions);
|
52
|
+
const keys = Object.keys(evaluator);
|
53
|
+
keys.forEach((k) => {
|
54
|
+
const entry = evaluator[k];
|
55
|
+
if (typeof entry === 'function') {
|
56
|
+
evaluator[k] = wrapWithLogger(entry);
|
57
|
+
}
|
58
|
+
});
|
59
|
+
return evaluator;
|
124
60
|
}
|
125
61
|
exports.createTypeEvaluatorWithTracker = createTypeEvaluatorWithTracker;
|
126
62
|
//# sourceMappingURL=typeEvaluatorWithTracker.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"typeEvaluatorWithTracker.js","sourceRoot":"","sources":["../../../src/analyzer/typeEvaluatorWithTracker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,yCAA6C;AAE7C,6CAA+C;AAG/C,mDAAwE;
|
1
|
+
{"version":3,"file":"typeEvaluatorWithTracker.js","sourceRoot":"","sources":["../../../src/analyzer/typeEvaluatorWithTracker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,+CAA6C;AAC7C,yCAA6C;AAE7C,6CAA+C;AAG/C,mDAAwE;AAExE,sFAAsF;AACtF,SAAgB,8BAA8B,CAC1C,YAA0B,EAC1B,gBAAkC,EAClC,MAAkB,EAClB,OAAsB;IAEtB,SAAS,cAAc,CAAoC,IAAO;QAC9D,kFAAkF;QAClF,6BAA6B;QAC7B,IAAI,gBAAgB,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,kBAAQ,CAAC,GAAG,EAAE;YAC/D,OAAO,CAAC,GAAG,IAAmB,EAAiB,EAAE;gBAC7C,OAAO,MAAM,CAAC,GAAG,CACb,IAAI,CAAC,IAAI,EACT,CAAC,CAAC,EAAE,EAAE;oBACF,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;wBACjD,mDAAmD;wBACnD,CAAC,CAAC,GAAG,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBAClD;yBAAM;wBACH,wBAAwB;wBACxB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;4BACf,CAAC,CAAC,GAAG,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC7B,CAAC,CAAC,CAAC;qBACN;oBACD,OAAO,oBAAW,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;gBACvE,CAAC,EACD,gBAAgB,CAAC,uBAAuB;gBACxC,oBAAoB,CAAC,IAAI,CAC5B,CAAC;YACN,CAAC,CAAC;SACL;aAAM,IAAI,CAAC,IAAA,kBAAW,GAAE,EAAE;YACvB,OAAO,oBAAW,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,oBAAW,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;SAClG;aAAM;YACH,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAED,sDAAsD;IACtD,YAAY,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAA,mCAAmB,EAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACf,MAAM,KAAK,GAAI,SAAiB,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;YAC5B,SAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;SACjD;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACrB,CAAC;AAhDD,wEAgDC"}
|
@@ -179,7 +179,8 @@ function getParameterListDetails(type) {
|
|
179
179
|
// If this is an unpacked tuple, expand the entries.
|
180
180
|
const paramType = types_1.FunctionType.getEffectiveParameterType(type, index);
|
181
181
|
if (param.name && (0, types_1.isUnpackedClass)(paramType) && paramType.tupleTypeArguments) {
|
182
|
-
|
182
|
+
const addToPositionalOnly = index < result.positionOnlyParamCount;
|
183
|
+
paramType.tupleTypeArguments.forEach((tupleArg, tupleIndex) => {
|
183
184
|
const category = (0, types_1.isVariadicTypeVar)(tupleArg.type) || tupleArg.isUnbounded
|
184
185
|
? 1 /* VarArgList */
|
185
186
|
: 0 /* Simple */;
|
@@ -191,11 +192,14 @@ function getParameterListDetails(type) {
|
|
191
192
|
}
|
192
193
|
addVirtualParameter({
|
193
194
|
category,
|
194
|
-
name: `${param.name}[${
|
195
|
+
name: `${param.name}[${tupleIndex.toString()}]`,
|
195
196
|
isNameSynthesized: true,
|
196
197
|
type: tupleArg.type,
|
197
198
|
hasDeclaredType: true,
|
198
|
-
},
|
199
|
+
}, tupleIndex, tupleArg.type);
|
200
|
+
if (tupleIndex > 0 && addToPositionalOnly) {
|
201
|
+
result.positionOnlyParamCount++;
|
202
|
+
}
|
199
203
|
});
|
200
204
|
}
|
201
205
|
else {
|
@@ -2057,7 +2061,7 @@ class TypeVarTransformer {
|
|
2057
2061
|
this._pendingTypeVarTransformations = new Set();
|
2058
2062
|
}
|
2059
2063
|
apply(type, recursionCount = 0) {
|
2060
|
-
var _a;
|
2064
|
+
var _a, _b;
|
2061
2065
|
if (recursionCount > types_1.maxTypeRecursionCount) {
|
2062
2066
|
return type;
|
2063
2067
|
}
|
@@ -2100,7 +2104,7 @@ class TypeVarTransformer {
|
|
2100
2104
|
// _pendingTypeVarTransformations set.
|
2101
2105
|
const typeVarName = types_1.TypeVarType.getNameWithScope(type);
|
2102
2106
|
if (!this._pendingTypeVarTransformations.has(typeVarName)) {
|
2103
|
-
replacementType = this.transformTypeVar(type);
|
2107
|
+
replacementType = (_b = this.transformTypeVar(type)) !== null && _b !== void 0 ? _b : type;
|
2104
2108
|
if (!this._isTransformingTypeArg) {
|
2105
2109
|
this._pendingTypeVarTransformations.add(typeVarName);
|
2106
2110
|
replacementType = this.apply(replacementType, recursionCount);
|
@@ -2236,7 +2240,8 @@ class TypeVarTransformer {
|
|
2236
2240
|
else {
|
2237
2241
|
const typeParamName = types_1.TypeVarType.getNameWithScope(typeParam);
|
2238
2242
|
if (!this._pendingTypeVarTransformations.has(typeParamName)) {
|
2239
|
-
|
2243
|
+
const transformedType = this.transformTypeVar(typeParam);
|
2244
|
+
replacementType = transformedType !== null && transformedType !== void 0 ? transformedType : typeParam;
|
2240
2245
|
if (replacementType !== typeParam) {
|
2241
2246
|
if (!this._isTransformingTypeArg) {
|
2242
2247
|
this._pendingTypeVarTransformations.add(typeParamName);
|
@@ -2245,6 +2250,9 @@ class TypeVarTransformer {
|
|
2245
2250
|
}
|
2246
2251
|
specializationNeeded = true;
|
2247
2252
|
}
|
2253
|
+
else if (transformedType !== undefined && !classType.typeArguments) {
|
2254
|
+
specializationNeeded = true;
|
2255
|
+
}
|
2248
2256
|
}
|
2249
2257
|
}
|
2250
2258
|
newTypeArgs.push(replacementType);
|
@@ -2477,7 +2485,7 @@ class ApplySolvedTypeVarsTransformer extends TypeVarTransformer {
|
|
2477
2485
|
return types_1.UnknownType.create();
|
2478
2486
|
}
|
2479
2487
|
}
|
2480
|
-
return
|
2488
|
+
return undefined;
|
2481
2489
|
}
|
2482
2490
|
transformUnionSubtype(preTransform, postTransform) {
|
2483
2491
|
// If a union contains unsolved TypeVars within scope, eliminate them
|