@zzzen/pyright-internal 1.2.0-dev.20220925 → 1.2.0-dev.20221009
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/analyzerFileInfo.d.ts +1 -1
- package/dist/analyzer/analyzerFileInfo.js +1 -1
- package/dist/analyzer/analyzerFileInfo.js.map +1 -1
- package/dist/analyzer/binder.js +41 -24
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/cacheManager.d.ts +14 -0
- package/dist/analyzer/cacheManager.js +63 -0
- package/dist/analyzer/cacheManager.js.map +1 -0
- package/dist/analyzer/checker.d.ts +1 -0
- package/dist/analyzer/checker.js +17 -0
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +8 -1
- package/dist/analyzer/codeFlowEngine.js +106 -85
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +1 -1
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +4 -4
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/program.d.ts +5 -0
- package/dist/analyzer/program.js +62 -44
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/service.js +1 -0
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +1 -1
- package/dist/analyzer/sourceFile.js +5 -5
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +58 -40
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +5 -0
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeStubWriter.js +6 -6
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +1 -1
- package/dist/analyzer/typeUtils.js +4 -31
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +6 -6
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.js +1 -1
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/commandController.d.ts +1 -0
- package/dist/commands/commandController.js +5 -0
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/commands.d.ts +7 -1
- package/dist/commands/commands.js +6 -0
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.d.ts +8 -0
- package/dist/commands/dumpFileDebugInfoCommand.js +983 -0
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -0
- package/dist/languageServerBase.js +6 -6
- package/dist/languageServerBase.js.map +1 -1
- package/dist/parser/parser.d.ts +2 -2
- package/dist/parser/parser.js +40 -29
- package/dist/parser/parser.js.map +1 -1
- package/dist/tests/parser.test.js +22 -0
- package/dist/tests/parser.test.js.map +1 -1
- package/dist/tests/testUtils.js +4 -2
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +4 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +16 -0
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/workspaceMap.js +2 -0
- package/dist/workspaceMap.js.map +1 -1
- package/package.json +1 -1
@@ -18,7 +18,7 @@ export interface ImportLookupResult {
|
|
18
18
|
}
|
19
19
|
export interface AnalyzerFileInfo {
|
20
20
|
importLookup: ImportLookup;
|
21
|
-
futureImports:
|
21
|
+
futureImports: Set<string>;
|
22
22
|
builtinsScope?: Scope | undefined;
|
23
23
|
diagnosticSink: TextRangeDiagnosticSink;
|
24
24
|
executionEnvironment: ExecutionEnvironment;
|
@@ -11,7 +11,7 @@
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.isAnnotationEvaluationPostponed = void 0;
|
13
13
|
function isAnnotationEvaluationPostponed(fileInfo) {
|
14
|
-
return fileInfo.futureImports.
|
14
|
+
return fileInfo.futureImports.has('annotations') || fileInfo.isStubFile;
|
15
15
|
}
|
16
16
|
exports.isAnnotationEvaluationPostponed = isAnnotationEvaluationPostponed;
|
17
17
|
//# sourceMappingURL=analyzerFileInfo.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"analyzerFileInfo.js","sourceRoot":"","sources":["../../../src/analyzer/analyzerFileInfo.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA8CH,SAAgB,+BAA+B,CAAC,QAA0B;IACtE,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,
|
1
|
+
{"version":3,"file":"analyzerFileInfo.js","sourceRoot":"","sources":["../../../src/analyzer/analyzerFileInfo.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA8CH,SAAgB,+BAA+B,CAAC,QAA0B;IACtE,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC;AAC5E,CAAC;AAFD,0EAEC"}
|
package/dist/analyzer/binder.js
CHANGED
@@ -2162,7 +2162,10 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
2162
2162
|
return Binder._unreachableFlowNode;
|
2163
2163
|
}
|
2164
2164
|
const expressionList = [];
|
2165
|
-
if (!this._isNarrowingExpression(expression, expressionList
|
2165
|
+
if (!this._isNarrowingExpression(expression, expressionList,
|
2166
|
+
/* filterForNeverNarrowing */ (flags &
|
2167
|
+
(codeFlowTypes_1.FlowFlags.TrueNeverCondition | codeFlowTypes_1.FlowFlags.FalseNeverCondition)) !==
|
2168
|
+
0)) {
|
2166
2169
|
return antecedent;
|
2167
2170
|
}
|
2168
2171
|
expressionList.forEach((expr) => {
|
@@ -2221,6 +2224,16 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
2221
2224
|
}
|
2222
2225
|
if ((0, codeFlowTypes_1.isCodeFlowSupportedForReference)(expression)) {
|
2223
2226
|
expressionList.push(expression);
|
2227
|
+
if (!filterForNeverNarrowing) {
|
2228
|
+
// If the expression is a member access expression, add its
|
2229
|
+
// leftExpression to the expression list because that expression
|
2230
|
+
// can be narrowed based on the attribute type.
|
2231
|
+
if (expression.nodeType === 35 /* MemberAccess */) {
|
2232
|
+
if ((0, codeFlowTypes_1.isCodeFlowSupportedForReference)(expression.leftExpression)) {
|
2233
|
+
expressionList.push(expression.leftExpression);
|
2234
|
+
}
|
2235
|
+
}
|
2236
|
+
}
|
2224
2237
|
return true;
|
2225
2238
|
}
|
2226
2239
|
return false;
|
@@ -2991,6 +3004,10 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
2991
3004
|
let isClassVar = false;
|
2992
3005
|
let classVarTypeNode;
|
2993
3006
|
while (typeAnnotation) {
|
3007
|
+
// Is this a quoted annotation?
|
3008
|
+
if (typeAnnotation.nodeType === 48 /* StringList */ && typeAnnotation.typeAnnotation) {
|
3009
|
+
typeAnnotation = typeAnnotation.typeAnnotation;
|
3010
|
+
}
|
2994
3011
|
if (typeAnnotation.nodeType === 24 /* Index */ &&
|
2995
3012
|
typeAnnotation.items.length > 0 &&
|
2996
3013
|
this._isTypingAnnotation(typeAnnotation.baseExpression, 'Annotated')) {
|
@@ -3155,29 +3172,29 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
3155
3172
|
return false;
|
3156
3173
|
}
|
3157
3174
|
const assignedNameNode = annotationNode.valueExpression;
|
3158
|
-
const specialTypes = new
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3175
|
+
const specialTypes = new Set([
|
3176
|
+
'Tuple',
|
3177
|
+
'Generic',
|
3178
|
+
'Protocol',
|
3179
|
+
'Callable',
|
3180
|
+
'Type',
|
3181
|
+
'ClassVar',
|
3182
|
+
'Final',
|
3183
|
+
'Literal',
|
3184
|
+
'TypedDict',
|
3185
|
+
'Union',
|
3186
|
+
'Optional',
|
3187
|
+
'Annotated',
|
3188
|
+
'TypeAlias',
|
3189
|
+
'OrderedDict',
|
3190
|
+
'Concatenate',
|
3191
|
+
'TypeGuard',
|
3192
|
+
'StrictTypeGuard',
|
3193
|
+
'Unpack',
|
3194
|
+
'Self',
|
3195
|
+
'NoReturn',
|
3196
|
+
'Never',
|
3197
|
+
'LiteralString',
|
3181
3198
|
]);
|
3182
3199
|
const assignedName = assignedNameNode.value;
|
3183
3200
|
if (!specialTypes.has(assignedName)) {
|