@zzzen/pyright-internal 1.2.0-dev.2022-07-02 → 1.2.0-dev.20220703
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/aliasDeclarationUtils.js +2 -2
- package/dist/analyzer/analyzerNodeInfo.d.ts +4 -1
- package/dist/analyzer/analyzerNodeInfo.js +12 -1
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/binder.d.ts +6 -1
- package/dist/analyzer/binder.js +133 -30
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.d.ts +4 -1
- package/dist/analyzer/checker.js +125 -47
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +6 -3
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +18 -6
- package/dist/analyzer/declaration.js +19 -9
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +1 -1
- package/dist/analyzer/declarationUtils.js +19 -16
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +6 -6
- package/dist/analyzer/parseTreeUtils.d.ts +3 -3
- package/dist/analyzer/parseTreeUtils.js +16 -11
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.d.ts +4 -1
- package/dist/analyzer/parseTreeWalker.js +19 -1
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/properties.js +2 -0
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.d.ts +0 -1
- package/dist/analyzer/protocols.js +1 -63
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/tracePrinter.js +8 -4
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +1 -1
- package/dist/analyzer/typeEvaluator.js +524 -176
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +2 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js +2 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
- package/dist/analyzer/typePrinter.js +4 -1
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.d.ts +4 -1
- package/dist/analyzer/typeStubWriter.js +36 -0
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.js +10 -5
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/types.d.ts +11 -4
- package/dist/analyzer/types.js +23 -8
- package/dist/analyzer/types.js.map +1 -1
- package/dist/languageService/autoImporter.js +1 -1
- package/dist/languageService/callHierarchyProvider.js +9 -9
- package/dist/languageService/completionProvider.js +19 -13
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/definitionProvider.js +3 -3
- package/dist/languageService/documentSymbolCollector.js +1 -1
- package/dist/languageService/documentSymbolProvider.js +10 -7
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.js +19 -5
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/referencesProvider.js +8 -5
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +1 -1
- package/dist/localization/localize.d.ts +27 -0
- package/dist/localization/localize.js +16 -0
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +18 -2
- package/dist/parser/parseNodes.d.ts +41 -5
- package/dist/parser/parseNodes.js +83 -4
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.d.ts +3 -0
- package/dist/parser/parser.js +129 -12
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/tokenizer.js +4 -3
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/tokenizerTypes.d.ts +5 -3
- package/dist/parser/tokenizerTypes.js +6 -4
- package/dist/parser/tokenizerTypes.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.d.ts +1 -0
- package/dist/tests/typeEvaluator5.test.js +112 -0
- package/dist/tests/typeEvaluator5.test.js.map +1 -0
- package/package.json +1 -1
@@ -22,7 +22,7 @@ function resolveAliasDeclaration(importLookup, declaration, resolveLocalNames, a
|
|
22
22
|
let privatePyTypedImported;
|
23
23
|
let privatePyTypedImporter;
|
24
24
|
while (true) {
|
25
|
-
if (curDeclaration.type !==
|
25
|
+
if (curDeclaration.type !== 8 /* Alias */ || !curDeclaration.symbolName) {
|
26
26
|
return {
|
27
27
|
declaration: curDeclaration,
|
28
28
|
isPrivate,
|
@@ -110,7 +110,7 @@ function resolveAliasDeclaration(importLookup, declaration, resolveLocalNames, a
|
|
110
110
|
// the module is foo, and the foo.__init__.py file contains the statement
|
111
111
|
// "from foo import bar", we want to import the foo/bar.py submodule.
|
112
112
|
if (curDeclaration.path === declaration.path &&
|
113
|
-
curDeclaration.type ===
|
113
|
+
curDeclaration.type === 8 /* Alias */ &&
|
114
114
|
curDeclaration.submoduleFallback) {
|
115
115
|
return resolveAliasDeclaration(importLookup, curDeclaration.submoduleFallback, resolveLocalNames, allowExternallyHiddenAccess);
|
116
116
|
}
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import { ClassNode, ExecutionScopeNode, FunctionNode, LambdaNode, ListComprehensionNode, ModuleNode, ParseNode, StringNode } from '../parser/parseNodes';
|
1
|
+
import { ClassNode, ExecutionScopeNode, FunctionNode, LambdaNode, ListComprehensionNode, ModuleNode, NameNode, ParseNode, StringNode } from '../parser/parseNodes';
|
2
2
|
import { AnalyzerFileInfo } from './analyzerFileInfo';
|
3
3
|
import { FlowNode } from './codeFlowTypes';
|
4
4
|
import { Declaration } from './declaration';
|
5
5
|
import { ImportResult } from './importResult';
|
6
6
|
import { Scope } from './scope';
|
7
|
+
import { Symbol } from './symbol';
|
7
8
|
export interface DunderAllInfo {
|
8
9
|
names: string[];
|
9
10
|
stringNodes: StringNode[];
|
@@ -29,4 +30,6 @@ export declare function getCodeFlowComplexity(node: ExecutionScopeNode): number;
|
|
29
30
|
export declare function setCodeFlowComplexity(node: ExecutionScopeNode, complexity: number): void;
|
30
31
|
export declare function getDunderAllInfo(node: ModuleNode): DunderAllInfo | undefined;
|
31
32
|
export declare function setDunderAllInfo(node: ModuleNode, names: DunderAllInfo | undefined): void;
|
33
|
+
export declare function getTypeParameterSymbol(node: NameNode): Symbol | undefined;
|
34
|
+
export declare function setTypeParameterSymbol(node: NameNode, symbol: Symbol): void;
|
32
35
|
export declare function isCodeUnreachable(node: ParseNode): boolean;
|
@@ -11,7 +11,7 @@
|
|
11
11
|
* (e.g. hover information).
|
12
12
|
*/
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
-
exports.isCodeUnreachable = exports.setDunderAllInfo = exports.getDunderAllInfo = exports.setCodeFlowComplexity = exports.getCodeFlowComplexity = exports.setCodeFlowExpressions = exports.getCodeFlowExpressions = exports.setFileInfo = exports.getFileInfo = exports.setAfterFlowNode = exports.getAfterFlowNode = exports.setFlowNode = exports.getFlowNode = exports.setDeclaration = exports.getDeclaration = exports.setScope = exports.getScope = exports.setImportInfo = exports.getImportInfo = exports.cleanNodeAnalysisInfo = void 0;
|
14
|
+
exports.isCodeUnreachable = exports.setTypeParameterSymbol = exports.getTypeParameterSymbol = exports.setDunderAllInfo = exports.getDunderAllInfo = exports.setCodeFlowComplexity = exports.getCodeFlowComplexity = exports.setCodeFlowExpressions = exports.getCodeFlowExpressions = exports.setFileInfo = exports.getFileInfo = exports.setAfterFlowNode = exports.getAfterFlowNode = exports.setFlowNode = exports.getFlowNode = exports.setDeclaration = exports.getDeclaration = exports.setScope = exports.getScope = exports.setImportInfo = exports.getImportInfo = exports.cleanNodeAnalysisInfo = void 0;
|
15
15
|
const codeFlowTypes_1 = require("./codeFlowTypes");
|
16
16
|
// Cleans out all fields that are added by the analyzer phases
|
17
17
|
// (after the post-parse walker).
|
@@ -25,6 +25,7 @@ function cleanNodeAnalysisInfo(node) {
|
|
25
25
|
delete analyzerNode.codeFlowExpressions;
|
26
26
|
delete analyzerNode.codeFlowComplexity;
|
27
27
|
delete analyzerNode.dunderAllInfo;
|
28
|
+
delete analyzerNode.typeParameterSymbol;
|
28
29
|
}
|
29
30
|
exports.cleanNodeAnalysisInfo = cleanNodeAnalysisInfo;
|
30
31
|
function getImportInfo(node) {
|
@@ -121,6 +122,16 @@ function setDunderAllInfo(node, names) {
|
|
121
122
|
analyzerNode.dunderAllInfo = names;
|
122
123
|
}
|
123
124
|
exports.setDunderAllInfo = setDunderAllInfo;
|
125
|
+
function getTypeParameterSymbol(node) {
|
126
|
+
const analyzerNode = node;
|
127
|
+
return analyzerNode.typeParameterSymbol;
|
128
|
+
}
|
129
|
+
exports.getTypeParameterSymbol = getTypeParameterSymbol;
|
130
|
+
function setTypeParameterSymbol(node, symbol) {
|
131
|
+
const analyzerNode = node;
|
132
|
+
analyzerNode.typeParameterSymbol = symbol;
|
133
|
+
}
|
134
|
+
exports.setTypeParameterSymbol = setTypeParameterSymbol;
|
124
135
|
function isCodeUnreachable(node) {
|
125
136
|
let curNode = node;
|
126
137
|
// Walk up the parse tree until we find a node with
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"analyzerNodeInfo.js","sourceRoot":"","sources":["../../../src/analyzer/analyzerNodeInfo.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;
|
1
|
+
{"version":3,"file":"analyzerNodeInfo.js","sourceRoot":"","sources":["../../../src/analyzer/analyzerNodeInfo.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAeH,mDAAsD;AAwDtD,8DAA8D;AAC9D,iCAAiC;AACjC,SAAgB,qBAAqB,CAAC,IAAe;IACjD,MAAM,YAAY,GAAG,IAAwB,CAAC;IAC9C,OAAO,YAAY,CAAC,KAAK,CAAC;IAC1B,OAAO,YAAY,CAAC,WAAW,CAAC;IAChC,OAAO,YAAY,CAAC,QAAQ,CAAC;IAC7B,OAAO,YAAY,C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ode, BinaryOperationNode, BreakNode, CallNode, ClassNode, ContinueNode, DelNode, ExceptNode, ForNode, FunctionNode, GlobalNode, IfNode, ImportAsNode, ImportFromNode, IndexNode, LambdaNode, ListComprehensionNode, MatchNode, MemberAccessNode, ModuleNameNode, ModuleNode, NameNode, NonlocalNode, ParseNode, PatternAsNode, PatternCaptureNode, PatternMappingExpandEntryNode, RaiseNode, ReturnNode, SuiteNode, TernaryNode, TryNode, TypeAnnotationNode, UnaryOperationNode, WhileNode, WithNode, YieldFromNode, YieldNode } from '../parser/parseNodes';
|
1
|
+
import { AssertNode, AssignmentExpressionNode, AssignmentNode, AugmentedAssignmentNode, AwaitNode, BinaryOperationNode, BreakNode, CallNode, ClassNode, ContinueNode, DelNode, ExceptNode, ForNode, FunctionNode, GlobalNode, IfNode, ImportAsNode, ImportFromNode, IndexNode, LambdaNode, ListComprehensionNode, MatchNode, MemberAccessNode, ModuleNameNode, ModuleNode, NameNode, NonlocalNode, ParseNode, PatternAsNode, PatternCaptureNode, PatternMappingExpandEntryNode, RaiseNode, ReturnNode, SuiteNode, TernaryNode, TryNode, TypeAliasNode, TypeAnnotationNode, TypeParameterListNode, UnaryOperationNode, WhileNode, WithNode, YieldFromNode, YieldNode } from '../parser/parseNodes';
|
2
2
|
import { AnalyzerFileInfo } from './analyzerFileInfo';
|
3
3
|
import { ParseTreeWalker } from './parseTreeWalker';
|
4
4
|
export declare class Binder extends ParseTreeWalker {
|
@@ -7,6 +7,7 @@ export declare class Binder extends ParseTreeWalker {
|
|
7
7
|
private _deferredBindingTasks;
|
8
8
|
private _currentScope;
|
9
9
|
private _currentFlowNode;
|
10
|
+
private _activeTypeParams;
|
10
11
|
private _targetFunctionDeclaration;
|
11
12
|
private _currentBreakTarget;
|
12
13
|
private _currentContinueTarget;
|
@@ -39,6 +40,8 @@ export declare class Binder extends ParseTreeWalker {
|
|
39
40
|
visitFunction(node: FunctionNode): boolean;
|
40
41
|
visitLambda(node: LambdaNode): boolean;
|
41
42
|
visitCall(node: CallNode): boolean;
|
43
|
+
visitTypeParameterList(node: TypeParameterListNode): boolean;
|
44
|
+
visitTypeAlias(node: TypeAliasNode): boolean;
|
42
45
|
visitAssignment(node: AssignmentNode): boolean;
|
43
46
|
visitAssignmentExpression(node: AssignmentExpressionNode): boolean;
|
44
47
|
visitAugmentedAssignment(node: AugmentedAssignmentNode): boolean;
|
@@ -73,6 +76,7 @@ export declare class Binder extends ParseTreeWalker {
|
|
73
76
|
visitPatternAs(node: PatternAsNode): boolean;
|
74
77
|
visitPatternCapture(node: PatternCaptureNode): boolean;
|
75
78
|
visitPatternMappingExpandEntry(node: PatternMappingExpandEntryNode): boolean;
|
79
|
+
private _removeActiveTypeParameters;
|
76
80
|
private _getNonClassParentScope;
|
77
81
|
private _addSlotsToCurrentScope;
|
78
82
|
private _isInListComprehension;
|
@@ -108,6 +112,7 @@ export declare class Binder extends ParseTreeWalker {
|
|
108
112
|
private _bindLoopStatement;
|
109
113
|
private _addAntecedent;
|
110
114
|
private _bindNameToScope;
|
115
|
+
private _bindNameValueToScope;
|
111
116
|
private _bindPossibleTupleNamedTarget;
|
112
117
|
private _addImplicitSymbolToCurrentScope;
|
113
118
|
private _addSymbolToCurrentScope;
|
package/dist/analyzer/binder.js
CHANGED
@@ -65,6 +65,9 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
65
65
|
this._moduleSymbolOnly = _moduleSymbolOnly;
|
66
66
|
// A queue of deferred analysis operations.
|
67
67
|
this._deferredBindingTasks = [];
|
68
|
+
// Tracks the type parameters that are currently active within the
|
69
|
+
// scope and any outer scopes.
|
70
|
+
this._activeTypeParams = new Map();
|
68
71
|
// Flow nodes used within try blocks.
|
69
72
|
this._currentExceptTargets = [];
|
70
73
|
// Flow nodes used within try/finally flows.
|
@@ -207,19 +210,22 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
207
210
|
visitClass(node) {
|
208
211
|
this.walkMultiple(node.decorators);
|
209
212
|
const classDeclaration = {
|
210
|
-
type:
|
213
|
+
type: 6 /* Class */,
|
211
214
|
node,
|
212
215
|
path: this._fileInfo.filePath,
|
213
216
|
range: (0, positionUtils_1.convertOffsetsToRange)(node.name.start, textRange_2.TextRange.getEnd(node.name), this._fileInfo.lines),
|
214
217
|
moduleName: this._fileInfo.moduleName,
|
215
218
|
isInExceptSuite: this._isInExceptSuite,
|
216
219
|
};
|
217
|
-
const symbol = this._bindNameToScope(this._currentScope, node.name
|
220
|
+
const symbol = this._bindNameToScope(this._currentScope, node.name);
|
218
221
|
if (symbol) {
|
219
222
|
symbol.addDeclaration(classDeclaration);
|
220
223
|
}
|
221
224
|
// Stash the declaration in the parse node for later access.
|
222
225
|
AnalyzerNodeInfo.setDeclaration(node, classDeclaration);
|
226
|
+
if (node.typeParameters) {
|
227
|
+
this.walk(node.typeParameters);
|
228
|
+
}
|
223
229
|
this.walkMultiple(node.arguments);
|
224
230
|
this._createNewScope(2 /* Class */, this._getNonClassParentScope(), () => {
|
225
231
|
AnalyzerNodeInfo.setScope(node, this._currentScope);
|
@@ -236,15 +242,18 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
236
242
|
this._dunderSlotsEntries = undefined;
|
237
243
|
});
|
238
244
|
this._createAssignmentTargetFlowNodes(node.name, /* walkTargets */ false, /* unbound */ false);
|
245
|
+
if (node.typeParameters) {
|
246
|
+
this._removeActiveTypeParameters(node.typeParameters);
|
247
|
+
}
|
239
248
|
return false;
|
240
249
|
}
|
241
250
|
visitFunction(node) {
|
242
251
|
this._createVariableAnnotationFlowNode();
|
243
252
|
AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
|
244
|
-
const symbol = this._bindNameToScope(this._currentScope, node.name
|
253
|
+
const symbol = this._bindNameToScope(this._currentScope, node.name);
|
245
254
|
const containingClassNode = ParseTreeUtils.getEnclosingClass(node, /* stopAtFunction */ true);
|
246
255
|
const functionDeclaration = {
|
247
|
-
type:
|
256
|
+
type: 5 /* Function */,
|
248
257
|
node,
|
249
258
|
isMethod: !!containingClassNode,
|
250
259
|
isGenerator: false,
|
@@ -258,11 +267,17 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
258
267
|
}
|
259
268
|
// Stash the declaration in the parse node for later access.
|
260
269
|
AnalyzerNodeInfo.setDeclaration(node, functionDeclaration);
|
261
|
-
|
270
|
+
// Walk the default values prior to the type parameters.
|
262
271
|
node.parameters.forEach((param) => {
|
263
272
|
if (param.defaultValue) {
|
264
273
|
this.walk(param.defaultValue);
|
265
274
|
}
|
275
|
+
});
|
276
|
+
if (node.typeParameters) {
|
277
|
+
this.walk(node.typeParameters);
|
278
|
+
}
|
279
|
+
this.walkMultiple(node.decorators);
|
280
|
+
node.parameters.forEach((param) => {
|
266
281
|
if (param.typeAnnotation) {
|
267
282
|
this.walk(param.typeAnnotation);
|
268
283
|
}
|
@@ -291,7 +306,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
291
306
|
this._codeFlowComplexity = 0;
|
292
307
|
node.parameters.forEach((paramNode) => {
|
293
308
|
if (paramNode.name) {
|
294
|
-
const symbol = this._bindNameToScope(this._currentScope, paramNode.name
|
309
|
+
const symbol = this._bindNameToScope(this._currentScope, paramNode.name);
|
295
310
|
if (symbol) {
|
296
311
|
const paramDeclaration = {
|
297
312
|
type: 2 /* Parameter */,
|
@@ -325,6 +340,9 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
325
340
|
});
|
326
341
|
});
|
327
342
|
this._createAssignmentTargetFlowNodes(node.name, /* walkTargets */ false, /* unbound */ false);
|
343
|
+
if (node.typeParameters) {
|
344
|
+
this._removeActiveTypeParameters(node.typeParameters);
|
345
|
+
}
|
328
346
|
// We'll walk the child nodes in a deferred manner, so don't walk them now.
|
329
347
|
return false;
|
330
348
|
}
|
@@ -345,7 +363,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
345
363
|
this._currentFlowNode = this._createStartFlowNode();
|
346
364
|
node.parameters.forEach((paramNode) => {
|
347
365
|
if (paramNode.name) {
|
348
|
-
const symbol = this._bindNameToScope(this._currentScope, paramNode.name
|
366
|
+
const symbol = this._bindNameToScope(this._currentScope, paramNode.name);
|
349
367
|
if (symbol) {
|
350
368
|
const paramDeclaration = {
|
351
369
|
type: 2 /* Parameter */,
|
@@ -360,6 +378,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
360
378
|
}
|
361
379
|
this._createFlowAssignment(paramNode.name);
|
362
380
|
this.walk(paramNode.name);
|
381
|
+
AnalyzerNodeInfo.setFlowNode(paramNode, this._currentFlowNode);
|
363
382
|
}
|
364
383
|
});
|
365
384
|
// Walk the expression that make up the lambda body.
|
@@ -455,6 +474,62 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
455
474
|
}
|
456
475
|
return false;
|
457
476
|
}
|
477
|
+
visitTypeParameterList(node) {
|
478
|
+
node.parameters.forEach((param) => {
|
479
|
+
if (param.boundExpression) {
|
480
|
+
this.walk(param.boundExpression);
|
481
|
+
}
|
482
|
+
});
|
483
|
+
node.parameters.forEach((param) => {
|
484
|
+
const name = param.name;
|
485
|
+
const symbol = new symbol_1.Symbol(0 /* None */);
|
486
|
+
const paramDeclaration = {
|
487
|
+
type: 3 /* TypeParameter */,
|
488
|
+
node: param,
|
489
|
+
path: this._fileInfo.filePath,
|
490
|
+
range: (0, positionUtils_1.convertOffsetsToRange)(node.start, textRange_2.TextRange.getEnd(node), this._fileInfo.lines),
|
491
|
+
moduleName: this._fileInfo.moduleName,
|
492
|
+
isInExceptSuite: this._isInExceptSuite,
|
493
|
+
};
|
494
|
+
symbol.addDeclaration(paramDeclaration);
|
495
|
+
AnalyzerNodeInfo.setDeclaration(name, paramDeclaration);
|
496
|
+
AnalyzerNodeInfo.setTypeParameterSymbol(name, symbol);
|
497
|
+
if (this._activeTypeParams.has(name.value)) {
|
498
|
+
this._addError(localize_1.Localizer.Diagnostic.typeParameterExistingTypeParameter().format({ name: name.value }), name);
|
499
|
+
}
|
500
|
+
else {
|
501
|
+
this._activeTypeParams.set(name.value, symbol);
|
502
|
+
}
|
503
|
+
});
|
504
|
+
return false;
|
505
|
+
}
|
506
|
+
visitTypeAlias(node) {
|
507
|
+
this._bindNameToScope(this._currentScope, node.name);
|
508
|
+
this.walk(node.name);
|
509
|
+
if (node.typeParameters) {
|
510
|
+
this.walk(node.typeParameters);
|
511
|
+
}
|
512
|
+
const typeAliasDeclaration = {
|
513
|
+
type: 4 /* TypeAlias */,
|
514
|
+
node,
|
515
|
+
path: this._fileInfo.filePath,
|
516
|
+
range: (0, positionUtils_1.convertOffsetsToRange)(node.name.start, textRange_2.TextRange.getEnd(node.name), this._fileInfo.lines),
|
517
|
+
moduleName: this._fileInfo.moduleName,
|
518
|
+
isInExceptSuite: this._isInExceptSuite,
|
519
|
+
};
|
520
|
+
const symbol = this._bindNameToScope(this._currentScope, node.name);
|
521
|
+
if (symbol) {
|
522
|
+
symbol.addDeclaration(typeAliasDeclaration);
|
523
|
+
}
|
524
|
+
// Stash the declaration in the parse node for later access.
|
525
|
+
AnalyzerNodeInfo.setDeclaration(node, typeAliasDeclaration);
|
526
|
+
this._createAssignmentTargetFlowNodes(node.name, /* walkTargets */ true, /* unbound */ false);
|
527
|
+
this.walk(node.expression);
|
528
|
+
if (node.typeParameters) {
|
529
|
+
this._removeActiveTypeParameters(node.typeParameters);
|
530
|
+
}
|
531
|
+
return false;
|
532
|
+
}
|
458
533
|
visitAssignment(node) {
|
459
534
|
if (this._handleTypingStubAssignmentOrAnnotation(node)) {
|
460
535
|
return false;
|
@@ -617,7 +692,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
617
692
|
}
|
618
693
|
curScope = curScope.parent;
|
619
694
|
}
|
620
|
-
this._bindNameToScope(containerScope, node.name
|
695
|
+
this._bindNameToScope(containerScope, node.name);
|
621
696
|
this._addInferredTypeAssignmentForVariable(node.name, node.rightExpression);
|
622
697
|
this._createAssignmentTargetFlowNodes(node.name, /* walkTargets */ true, /* unbound */ false);
|
623
698
|
}
|
@@ -794,6 +869,10 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
794
869
|
}
|
795
870
|
visitName(node) {
|
796
871
|
AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
|
872
|
+
const typeParamSymbol = this._activeTypeParams.get(node.value);
|
873
|
+
if (typeParamSymbol) {
|
874
|
+
AnalyzerNodeInfo.setTypeParameterSymbol(node, typeParamSymbol);
|
875
|
+
}
|
797
876
|
// Name nodes have no children.
|
798
877
|
return false;
|
799
878
|
}
|
@@ -876,7 +955,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
876
955
|
}
|
877
956
|
if (node.name) {
|
878
957
|
this.walk(node.name);
|
879
|
-
const symbol = this._bindNameToScope(this._currentScope, node.name
|
958
|
+
const symbol = this._bindNameToScope(this._currentScope, node.name);
|
880
959
|
this._createAssignmentTargetFlowNodes(node.name, /* walkTargets */ true, /* unbound */ false);
|
881
960
|
if (symbol) {
|
882
961
|
const declaration = {
|
@@ -1074,7 +1153,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1074
1153
|
this._addError(localize_1.Localizer.Diagnostic.globalReassignment().format({ name: nameValue }), name);
|
1075
1154
|
}
|
1076
1155
|
// Add it to the global scope if it's not already added.
|
1077
|
-
this._bindNameToScope(globalScope,
|
1156
|
+
this._bindNameToScope(globalScope, name);
|
1078
1157
|
if (this._currentScope !== globalScope) {
|
1079
1158
|
this._currentScope.setBindingType(nameValue, 1 /* Global */);
|
1080
1159
|
}
|
@@ -1113,16 +1192,19 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1113
1192
|
if (node.module.nameParts.length > 0) {
|
1114
1193
|
const firstNamePartValue = node.module.nameParts[0].value;
|
1115
1194
|
let symbolName;
|
1195
|
+
let symbolNameNode;
|
1116
1196
|
if (node.alias) {
|
1117
1197
|
// The symbol name is defined by the alias.
|
1118
1198
|
symbolName = node.alias.value;
|
1199
|
+
symbolNameNode = node.alias;
|
1119
1200
|
}
|
1120
1201
|
else {
|
1121
1202
|
// There was no alias, so we need to use the first element of
|
1122
1203
|
// the name parts as the symbol.
|
1123
1204
|
symbolName = firstNamePartValue;
|
1205
|
+
symbolNameNode = node.module.nameParts[0];
|
1124
1206
|
}
|
1125
|
-
const symbol = this._bindNameToScope(this._currentScope,
|
1207
|
+
const symbol = this._bindNameToScope(this._currentScope, symbolNameNode);
|
1126
1208
|
if (symbol &&
|
1127
1209
|
(this._currentScope.type === 3 /* Module */ || this._currentScope.type === 4 /* Builtin */) &&
|
1128
1210
|
(!node.alias ||
|
@@ -1203,14 +1285,14 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1203
1285
|
}
|
1204
1286
|
}
|
1205
1287
|
wildcardNames.forEach((name) => {
|
1206
|
-
const localSymbol = this.
|
1288
|
+
const localSymbol = this._bindNameValueToScope(this._currentScope, name);
|
1207
1289
|
if (localSymbol) {
|
1208
1290
|
const importedSymbol = lookupInfo.symbolTable.get(name);
|
1209
1291
|
// Is the symbol in the target module's symbol table? If so,
|
1210
1292
|
// alias it.
|
1211
1293
|
if (importedSymbol) {
|
1212
1294
|
const aliasDecl = {
|
1213
|
-
type:
|
1295
|
+
type: 8 /* Alias */,
|
1214
1296
|
node,
|
1215
1297
|
path: resolvedPath,
|
1216
1298
|
loadSymbolsFromPath: true,
|
@@ -1230,7 +1312,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1230
1312
|
const implicitImport = importInfo.filteredImplicitImports.find((imp) => imp.name === name);
|
1231
1313
|
if (implicitImport) {
|
1232
1314
|
const submoduleFallback = {
|
1233
|
-
type:
|
1315
|
+
type: 8 /* Alias */,
|
1234
1316
|
node,
|
1235
1317
|
path: implicitImport.path,
|
1236
1318
|
loadSymbolsFromPath: true,
|
@@ -1240,7 +1322,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1240
1322
|
isInExceptSuite: this._isInExceptSuite,
|
1241
1323
|
};
|
1242
1324
|
const aliasDecl = {
|
1243
|
-
type:
|
1325
|
+
type: 8 /* Alias */,
|
1244
1326
|
node,
|
1245
1327
|
path: resolvedPath,
|
1246
1328
|
loadSymbolsFromPath: true,
|
@@ -1278,7 +1360,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1278
1360
|
node.imports.forEach((importSymbolNode) => {
|
1279
1361
|
const importedName = importSymbolNode.name.value;
|
1280
1362
|
const nameNode = importSymbolNode.alias || importSymbolNode.name;
|
1281
|
-
const symbol = this._bindNameToScope(this._currentScope, nameNode
|
1363
|
+
const symbol = this._bindNameToScope(this._currentScope, nameNode);
|
1282
1364
|
if (symbol) {
|
1283
1365
|
// All import statements of the form `from . import x` treat x
|
1284
1366
|
// as an externally-visible (not hidden) symbol.
|
@@ -1306,7 +1388,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1306
1388
|
let loadSymbolsFromPath = true;
|
1307
1389
|
if (implicitImport) {
|
1308
1390
|
submoduleFallback = {
|
1309
|
-
type:
|
1391
|
+
type: 8 /* Alias */,
|
1310
1392
|
node: importSymbolNode,
|
1311
1393
|
path: implicitImport.path,
|
1312
1394
|
loadSymbolsFromPath: true,
|
@@ -1325,7 +1407,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1325
1407
|
}
|
1326
1408
|
}
|
1327
1409
|
const aliasDecl = {
|
1328
|
-
type:
|
1410
|
+
type: 8 /* Alias */,
|
1329
1411
|
node: importSymbolNode,
|
1330
1412
|
path: resolvedPath,
|
1331
1413
|
loadSymbolsFromPath,
|
@@ -1605,7 +1687,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1605
1687
|
this._currentFlowNode = this._finishFlowLabel(postOrLabel);
|
1606
1688
|
if (node.target) {
|
1607
1689
|
this.walk(node.target);
|
1608
|
-
const symbol = this._bindNameToScope(this._currentScope, node.target
|
1690
|
+
const symbol = this._bindNameToScope(this._currentScope, node.target);
|
1609
1691
|
this._createAssignmentTargetFlowNodes(node.target, /* walkTargets */ false, /* unbound */ false);
|
1610
1692
|
if (symbol) {
|
1611
1693
|
const declaration = {
|
@@ -1635,6 +1717,18 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1635
1717
|
}
|
1636
1718
|
return true;
|
1637
1719
|
}
|
1720
|
+
_removeActiveTypeParameters(node) {
|
1721
|
+
node.parameters.forEach((typeParamNode) => {
|
1722
|
+
const entry = this._activeTypeParams.get(typeParamNode.name.value);
|
1723
|
+
if (entry) {
|
1724
|
+
const decls = entry.getDeclarations();
|
1725
|
+
(0, debug_1.assert)(decls && decls.length === 1 && decls[0].type === 3 /* TypeParameter */);
|
1726
|
+
if (decls[0].node === typeParamNode) {
|
1727
|
+
this._activeTypeParams.delete(typeParamNode.name.value);
|
1728
|
+
}
|
1729
|
+
}
|
1730
|
+
});
|
1731
|
+
}
|
1638
1732
|
_getNonClassParentScope() {
|
1639
1733
|
// We may not be able to use the current scope if it's a class scope.
|
1640
1734
|
// Walk up until we find a non-class scope instead.
|
@@ -1700,7 +1794,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1700
1794
|
return false;
|
1701
1795
|
}
|
1702
1796
|
_addPatternCaptureTarget(target) {
|
1703
|
-
const symbol = this._bindNameToScope(this._currentScope, target
|
1797
|
+
const symbol = this._bindNameToScope(this._currentScope, target);
|
1704
1798
|
this._createAssignmentTargetFlowNodes(target, /* walkTargets */ false, /* unbound */ false);
|
1705
1799
|
if (symbol) {
|
1706
1800
|
const declaration = {
|
@@ -1731,7 +1825,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1731
1825
|
return undefined;
|
1732
1826
|
}
|
1733
1827
|
// There should be only one declaration for the variable.
|
1734
|
-
const aliasDecl = varSymbol.getDeclarations().find((decl) => decl.type ===
|
1828
|
+
const aliasDecl = varSymbol.getDeclarations().find((decl) => decl.type === 8 /* Alias */);
|
1735
1829
|
const resolvedPath = (aliasDecl === null || aliasDecl === void 0 ? void 0 : aliasDecl.path) && aliasDecl.loadSymbolsFromPath
|
1736
1830
|
? aliasDecl.path
|
1737
1831
|
: ((_a = aliasDecl === null || aliasDecl === void 0 ? void 0 : aliasDecl.submoduleFallback) === null || _a === void 0 ? void 0 : _a.path) && aliasDecl.submoduleFallback.loadSymbolsFromPath
|
@@ -1748,7 +1842,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1748
1842
|
}
|
1749
1843
|
_addImplicitFromImport(node, importInfo) {
|
1750
1844
|
const symbolName = node.module.nameParts[0].value;
|
1751
|
-
const symbol = this.
|
1845
|
+
const symbol = this._bindNameValueToScope(this._currentScope, symbolName);
|
1752
1846
|
if (symbol) {
|
1753
1847
|
this._createAliasDeclarationForMultipartImportName(node, /* importAlias */ undefined, importInfo, symbol);
|
1754
1848
|
}
|
@@ -1766,7 +1860,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1766
1860
|
// python module loader.
|
1767
1861
|
const existingDecl = symbol
|
1768
1862
|
.getDeclarations()
|
1769
|
-
.find((decl) => decl.type ===
|
1863
|
+
.find((decl) => decl.type === 8 /* Alias */ && decl.firstNamePart === firstNamePartValue);
|
1770
1864
|
let newDecl;
|
1771
1865
|
let pathOfLastSubmodule;
|
1772
1866
|
if (importInfo && importInfo.isImportFound && !importInfo.isNativeLib && importInfo.resolvedPaths.length > 0) {
|
@@ -1781,7 +1875,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1781
1875
|
}
|
1782
1876
|
else if (isResolved) {
|
1783
1877
|
newDecl = {
|
1784
|
-
type:
|
1878
|
+
type: 8 /* Alias */,
|
1785
1879
|
node,
|
1786
1880
|
path: pathOfLastSubmodule,
|
1787
1881
|
loadSymbolsFromPath: false,
|
@@ -1797,7 +1891,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
1797
1891
|
// bogus path so it gets an unknown type (rather than an unbound type) at
|
1798
1892
|
// analysis time.
|
1799
1893
|
newDecl = {
|
1800
|
-
type:
|
1894
|
+
type: 8 /* Alias */,
|
1801
1895
|
node,
|
1802
1896
|
path: pathOfLastSubmodule,
|
1803
1897
|
loadSymbolsFromPath: true,
|
@@ -2388,7 +2482,14 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
2388
2482
|
}
|
2389
2483
|
}
|
2390
2484
|
}
|
2391
|
-
_bindNameToScope(scope,
|
2485
|
+
_bindNameToScope(scope, node, addedSymbols) {
|
2486
|
+
// Is this name already used by an active type parameter?
|
2487
|
+
if (this._activeTypeParams.get(node.value)) {
|
2488
|
+
this._addError(localize_1.Localizer.Diagnostic.overwriteTypeParameter().format({ name: node.value }), node);
|
2489
|
+
}
|
2490
|
+
return this._bindNameValueToScope(scope, node.value, addedSymbols);
|
2491
|
+
}
|
2492
|
+
_bindNameValueToScope(scope, name, addedSymbols) {
|
2392
2493
|
// Is this name already bound to a scope other than the local one?
|
2393
2494
|
const bindingType = this._currentScope.getBindingType(name);
|
2394
2495
|
if (bindingType !== undefined) {
|
@@ -2436,7 +2537,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
2436
2537
|
_bindPossibleTupleNamedTarget(target, addedSymbols) {
|
2437
2538
|
switch (target.nodeType) {
|
2438
2539
|
case 38 /* Name */: {
|
2439
|
-
this._bindNameToScope(this._currentScope, target
|
2540
|
+
this._bindNameToScope(this._currentScope, target, addedSymbols);
|
2440
2541
|
break;
|
2441
2542
|
}
|
2442
2543
|
case 52 /* Tuple */: {
|
@@ -2554,7 +2655,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
2554
2655
|
if (!symbol.isClassMember() ||
|
2555
2656
|
!symbol
|
2556
2657
|
.getDeclarations()
|
2557
|
-
.some((decl) => decl.type ===
|
2658
|
+
.some((decl) => decl.type === 5 /* Function */ && decl.isMethod)) {
|
2558
2659
|
symbol.setIsInstanceMember();
|
2559
2660
|
}
|
2560
2661
|
}
|
@@ -3067,10 +3168,10 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
3067
3168
|
if (!specialTypes.has(assignedName)) {
|
3068
3169
|
return false;
|
3069
3170
|
}
|
3070
|
-
const symbol = this._bindNameToScope(this._currentScope,
|
3171
|
+
const symbol = this._bindNameToScope(this._currentScope, annotationNode.valueExpression);
|
3071
3172
|
if (symbol) {
|
3072
3173
|
symbol.addDeclaration({
|
3073
|
-
type:
|
3174
|
+
type: 7 /* SpecialBuiltInClass */,
|
3074
3175
|
node: annotationNode,
|
3075
3176
|
path: this._fileInfo.filePath,
|
3076
3177
|
range: (0, positionUtils_1.convertOffsetsToRange)(annotationNode.start, textRange_2.TextRange.getEnd(annotationNode), this._fileInfo.lines),
|
@@ -3087,6 +3188,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
3087
3188
|
this._deferredBindingTasks.push({
|
3088
3189
|
scope: this._currentScope,
|
3089
3190
|
codeFlowExpressions: this._currentScopeCodeFlowExpressions,
|
3191
|
+
activeTypeParams: new Map(this._activeTypeParams),
|
3090
3192
|
callback,
|
3091
3193
|
});
|
3092
3194
|
}
|
@@ -3096,6 +3198,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
|
|
3096
3198
|
// Reset the state
|
3097
3199
|
this._currentScope = nextItem.scope;
|
3098
3200
|
this._currentScopeCodeFlowExpressions = nextItem.codeFlowExpressions;
|
3201
|
+
this._activeTypeParams = nextItem.activeTypeParams;
|
3099
3202
|
nextItem.callback();
|
3100
3203
|
}
|
3101
3204
|
}
|