@zzzen/pyright-internal 1.2.0-dev.20230430 → 1.2.0-dev.20230514

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.
Files changed (231) hide show
  1. package/dist/analyzer/backgroundAnalysisProgram.d.ts +4 -1
  2. package/dist/analyzer/backgroundAnalysisProgram.js +12 -0
  3. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  4. package/dist/analyzer/checker.d.ts +1 -0
  5. package/dist/analyzer/checker.js +89 -6
  6. package/dist/analyzer/checker.js.map +1 -1
  7. package/dist/analyzer/constraintSolver.js +14 -15
  8. package/dist/analyzer/constraintSolver.js.map +1 -1
  9. package/dist/analyzer/constructors.d.ts +6 -0
  10. package/dist/analyzer/constructors.js +513 -0
  11. package/dist/analyzer/constructors.js.map +1 -0
  12. package/dist/analyzer/dataClasses.js +86 -2
  13. package/dist/analyzer/dataClasses.js.map +1 -1
  14. package/dist/analyzer/docStringConversion.js +1 -1
  15. package/dist/analyzer/docStringConversion.js.map +1 -1
  16. package/dist/analyzer/enums.js +62 -8
  17. package/dist/analyzer/enums.js.map +1 -1
  18. package/dist/analyzer/importResolver.js +47 -29
  19. package/dist/analyzer/importResolver.js.map +1 -1
  20. package/dist/analyzer/importStatementUtils.d.ts +2 -2
  21. package/dist/analyzer/importStatementUtils.js.map +1 -1
  22. package/dist/analyzer/namedTuples.js +3 -6
  23. package/dist/analyzer/namedTuples.js.map +1 -1
  24. package/dist/analyzer/operations.d.ts +16 -0
  25. package/dist/analyzer/operations.js +749 -0
  26. package/dist/analyzer/operations.js.map +1 -0
  27. package/dist/analyzer/parseTreeUtils.d.ts +4 -2
  28. package/dist/analyzer/parseTreeUtils.js +32 -1
  29. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  30. package/dist/analyzer/patternMatching.js +16 -0
  31. package/dist/analyzer/patternMatching.js.map +1 -1
  32. package/dist/analyzer/program.d.ts +11 -33
  33. package/dist/analyzer/program.js +73 -735
  34. package/dist/analyzer/program.js.map +1 -1
  35. package/dist/analyzer/protocols.js +1 -1
  36. package/dist/analyzer/protocols.js.map +1 -1
  37. package/dist/analyzer/service.d.ts +5 -21
  38. package/dist/analyzer/service.js +26 -33
  39. package/dist/analyzer/service.js.map +1 -1
  40. package/dist/analyzer/sourceFile.d.ts +9 -41
  41. package/dist/analyzer/sourceFile.js +219 -238
  42. package/dist/analyzer/sourceFile.js.map +1 -1
  43. package/dist/analyzer/sourceFileInfoUtils.d.ts +3 -9
  44. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  45. package/dist/analyzer/symbol.d.ts +3 -1
  46. package/dist/analyzer/symbol.js +5 -0
  47. package/dist/analyzer/symbol.js.map +1 -1
  48. package/dist/analyzer/typeEvaluator.js +460 -1425
  49. package/dist/analyzer/typeEvaluator.js.map +1 -1
  50. package/dist/analyzer/typeEvaluatorTypes.d.ts +42 -7
  51. package/dist/analyzer/typeEvaluatorTypes.js +33 -1
  52. package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
  53. package/dist/analyzer/typeGuards.js +2 -8
  54. package/dist/analyzer/typeGuards.js.map +1 -1
  55. package/dist/analyzer/typePrinter.d.ts +3 -3
  56. package/dist/analyzer/typePrinter.js +247 -100
  57. package/dist/analyzer/typePrinter.js.map +1 -1
  58. package/dist/analyzer/typeUtils.d.ts +14 -7
  59. package/dist/analyzer/typeUtils.js +204 -49
  60. package/dist/analyzer/typeUtils.js.map +1 -1
  61. package/dist/analyzer/typeVarContext.d.ts +6 -7
  62. package/dist/analyzer/typeVarContext.js +21 -32
  63. package/dist/analyzer/typeVarContext.js.map +1 -1
  64. package/dist/analyzer/typedDicts.js +2 -2
  65. package/dist/analyzer/typedDicts.js.map +1 -1
  66. package/dist/analyzer/types.d.ts +7 -4
  67. package/dist/analyzer/types.js +20 -10
  68. package/dist/analyzer/types.js.map +1 -1
  69. package/dist/backgroundAnalysisBase.d.ts +1 -1
  70. package/dist/backgroundAnalysisBase.js +16 -0
  71. package/dist/backgroundAnalysisBase.js.map +1 -1
  72. package/dist/commands/dumpFileDebugInfoCommand.js +0 -1
  73. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  74. package/dist/common/extensibility.d.ts +28 -4
  75. package/dist/common/extensibility.js.map +1 -1
  76. package/dist/common/logTracker.d.ts +2 -0
  77. package/dist/common/logTracker.js +8 -1
  78. package/dist/common/logTracker.js.map +1 -1
  79. package/dist/common/lspUtils.d.ts +4 -1
  80. package/dist/common/lspUtils.js +38 -1
  81. package/dist/common/lspUtils.js.map +1 -1
  82. package/dist/common/pathUtils.d.ts +11 -11
  83. package/dist/common/pathUtils.js.map +1 -1
  84. package/dist/common/pythonVersion.d.ts +2 -1
  85. package/dist/common/pythonVersion.js +1 -0
  86. package/dist/common/pythonVersion.js.map +1 -1
  87. package/dist/common/workspaceEditUtils.d.ts +8 -8
  88. package/dist/common/workspaceEditUtils.js +10 -10
  89. package/dist/common/workspaceEditUtils.js.map +1 -1
  90. package/dist/languageServerBase.d.ts +3 -7
  91. package/dist/languageServerBase.js +41 -73
  92. package/dist/languageServerBase.js.map +1 -1
  93. package/dist/languageService/autoImporter.d.ts +50 -51
  94. package/dist/languageService/autoImporter.js +125 -210
  95. package/dist/languageService/autoImporter.js.map +1 -1
  96. package/dist/languageService/callHierarchyProvider.d.ts +1 -1
  97. package/dist/languageService/callHierarchyProvider.js +11 -37
  98. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  99. package/dist/languageService/completionProvider.d.ts +39 -81
  100. package/dist/languageService/completionProvider.js +572 -801
  101. package/dist/languageService/completionProvider.js.map +1 -1
  102. package/dist/languageService/documentHighlightProvider.js +1 -1
  103. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  104. package/dist/languageService/documentSymbolCollector.d.ts +6 -7
  105. package/dist/languageService/documentSymbolCollector.js +47 -28
  106. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  107. package/dist/languageService/documentSymbolProvider.d.ts +13 -35
  108. package/dist/languageService/documentSymbolProvider.js +52 -264
  109. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  110. package/dist/languageService/hoverProvider.d.ts +5 -6
  111. package/dist/languageService/hoverProvider.js +40 -132
  112. package/dist/languageService/hoverProvider.js.map +1 -1
  113. package/dist/languageService/referencesProvider.d.ts +6 -11
  114. package/dist/languageService/referencesProvider.js +23 -17
  115. package/dist/languageService/referencesProvider.js.map +1 -1
  116. package/dist/languageService/renameProvider.d.ts +16 -0
  117. package/dist/languageService/renameProvider.js +139 -0
  118. package/dist/languageService/renameProvider.js.map +1 -0
  119. package/dist/languageService/symbolIndexer.d.ts +31 -0
  120. package/dist/languageService/symbolIndexer.js +105 -0
  121. package/dist/languageService/symbolIndexer.js.map +1 -0
  122. package/dist/languageService/tooltipUtils.d.ts +8 -1
  123. package/dist/languageService/tooltipUtils.js +102 -1
  124. package/dist/languageService/tooltipUtils.js.map +1 -1
  125. package/dist/languageService/workspaceSymbolProvider.d.ts +17 -0
  126. package/dist/languageService/workspaceSymbolProvider.js +133 -0
  127. package/dist/languageService/workspaceSymbolProvider.js.map +1 -0
  128. package/dist/localization/localize.d.ts +33 -15
  129. package/dist/localization/localize.js +13 -7
  130. package/dist/localization/localize.js.map +1 -1
  131. package/dist/localization/package.nls.en-us.json +14 -7
  132. package/dist/parser/parser.js +3 -0
  133. package/dist/parser/parser.js.map +1 -1
  134. package/dist/pyright.js +26 -4
  135. package/dist/pyright.js.map +1 -1
  136. package/dist/tests/chainedSourceFiles.test.js +15 -20
  137. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  138. package/dist/tests/checker.test.js +14 -0
  139. package/dist/tests/checker.test.js.map +1 -1
  140. package/dist/tests/completions.test.js +11 -236
  141. package/dist/tests/completions.test.js.map +1 -1
  142. package/dist/tests/docStringConversion.test.js +36 -2
  143. package/dist/tests/docStringConversion.test.js.map +1 -1
  144. package/dist/tests/documentSymbolCollector.test.js +3 -3
  145. package/dist/tests/documentSymbolCollector.test.js.map +1 -1
  146. package/dist/tests/fourslash/completions.override2.fourslash.js +1 -16
  147. package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -1
  148. package/dist/tests/fourslash/fourslash.d.ts +4 -4
  149. package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js +1 -1
  150. package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js.map +1 -1
  151. package/dist/tests/harness/fourslash/testState.d.ts +17 -11
  152. package/dist/tests/harness/fourslash/testState.js +39 -50
  153. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  154. package/dist/tests/importResolver.test.js +81 -1
  155. package/dist/tests/importResolver.test.js.map +1 -1
  156. package/dist/tests/sourceFile.test.js +1 -1
  157. package/dist/tests/sourceFile.test.js.map +1 -1
  158. package/dist/tests/testStateUtils.d.ts +2 -2
  159. package/dist/tests/testStateUtils.js +38 -8
  160. package/dist/tests/testStateUtils.js.map +1 -1
  161. package/dist/tests/typeEvaluator2.test.js +13 -1
  162. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  163. package/dist/tests/typeEvaluator3.test.js +5 -1
  164. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  165. package/dist/tests/typeEvaluator4.test.js +9 -1
  166. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  167. package/dist/tests/typeEvaluator5.test.js +25 -9
  168. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  169. package/dist/tests/workspaceEditUtils.test.js +95 -6
  170. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  171. package/package.json +4 -4
  172. package/dist/languageService/importAdder.d.ts +0 -40
  173. package/dist/languageService/importAdder.js +0 -388
  174. package/dist/languageService/importAdder.js.map +0 -1
  175. package/dist/languageService/indentationUtils.d.ts +0 -16
  176. package/dist/languageService/indentationUtils.js +0 -727
  177. package/dist/languageService/indentationUtils.js.map +0 -1
  178. package/dist/languageService/insertionPointUtils.d.ts +0 -9
  179. package/dist/languageService/insertionPointUtils.js +0 -132
  180. package/dist/languageService/insertionPointUtils.js.map +0 -1
  181. package/dist/languageService/renameModuleProvider.d.ts +0 -65
  182. package/dist/languageService/renameModuleProvider.js +0 -939
  183. package/dist/languageService/renameModuleProvider.js.map +0 -1
  184. package/dist/tests/fourslash/completions.commitChars.fourslash.d.ts +0 -1
  185. package/dist/tests/fourslash/completions.commitChars.fourslash.js +0 -81
  186. package/dist/tests/fourslash/completions.commitChars.fourslash.js.map +0 -1
  187. package/dist/tests/importAdder.test.d.ts +0 -1
  188. package/dist/tests/importAdder.test.js +0 -1325
  189. package/dist/tests/importAdder.test.js.map +0 -1
  190. package/dist/tests/indentationUtils.ptvs.test.d.ts +0 -1
  191. package/dist/tests/indentationUtils.ptvs.test.js +0 -324
  192. package/dist/tests/indentationUtils.ptvs.test.js.map +0 -1
  193. package/dist/tests/indentationUtils.reindent.test.d.ts +0 -1
  194. package/dist/tests/indentationUtils.reindent.test.js +0 -372
  195. package/dist/tests/indentationUtils.reindent.test.js.map +0 -1
  196. package/dist/tests/indentationUtils.test.d.ts +0 -1
  197. package/dist/tests/indentationUtils.test.js +0 -502
  198. package/dist/tests/indentationUtils.test.js.map +0 -1
  199. package/dist/tests/insertionPointUtils.test.d.ts +0 -1
  200. package/dist/tests/insertionPointUtils.test.js +0 -154
  201. package/dist/tests/insertionPointUtils.test.js.map +0 -1
  202. package/dist/tests/moveSymbol.importAdder.test.d.ts +0 -1
  203. package/dist/tests/moveSymbol.importAdder.test.js +0 -298
  204. package/dist/tests/moveSymbol.importAdder.test.js.map +0 -1
  205. package/dist/tests/moveSymbol.insertion.test.d.ts +0 -1
  206. package/dist/tests/moveSymbol.insertion.test.js +0 -537
  207. package/dist/tests/moveSymbol.insertion.test.js.map +0 -1
  208. package/dist/tests/moveSymbol.misc.test.d.ts +0 -1
  209. package/dist/tests/moveSymbol.misc.test.js +0 -169
  210. package/dist/tests/moveSymbol.misc.test.js.map +0 -1
  211. package/dist/tests/moveSymbol.updateReference.test.d.ts +0 -1
  212. package/dist/tests/moveSymbol.updateReference.test.js +0 -1071
  213. package/dist/tests/moveSymbol.updateReference.test.js.map +0 -1
  214. package/dist/tests/renameModule.folder.test.d.ts +0 -1
  215. package/dist/tests/renameModule.folder.test.js +0 -229
  216. package/dist/tests/renameModule.folder.test.js.map +0 -1
  217. package/dist/tests/renameModule.fromImports.test.d.ts +0 -1
  218. package/dist/tests/renameModule.fromImports.test.js +0 -790
  219. package/dist/tests/renameModule.fromImports.test.js.map +0 -1
  220. package/dist/tests/renameModule.imports.test.d.ts +0 -1
  221. package/dist/tests/renameModule.imports.test.js +0 -380
  222. package/dist/tests/renameModule.imports.test.js.map +0 -1
  223. package/dist/tests/renameModule.misc.test.d.ts +0 -1
  224. package/dist/tests/renameModule.misc.test.js +0 -615
  225. package/dist/tests/renameModule.misc.test.js.map +0 -1
  226. package/dist/tests/renameModule.relativePath.test.d.ts +0 -1
  227. package/dist/tests/renameModule.relativePath.test.js +0 -231
  228. package/dist/tests/renameModule.relativePath.test.js.map +0 -1
  229. package/dist/tests/renameModuleTestUtils.d.ts +0 -4
  230. package/dist/tests/renameModuleTestUtils.js +0 -76
  231. package/dist/tests/renameModuleTestUtils.js.map +0 -1
@@ -0,0 +1,513 @@
1
+ "use strict";
2
+ /*
3
+ * constructors.ts
4
+ * Copyright (c) Microsoft Corporation.
5
+ * Licensed under the MIT license.
6
+ * Author: Eric Traut
7
+ *
8
+ * Provides type evaluation logic for constructors. A constructor
9
+ * in Python is implemented by a `__call__` method on the metaclass,
10
+ * which is typically the `type` class. The default implementation
11
+ * calls the `__new__` method on the class to allocate the object.
12
+ * If the resulting object is an instance of the class, it then calls
13
+ * the `__init__` method on the resulting object with the same arguments.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.createFunctionFromConstructor = exports.validateConstructorArguments = void 0;
17
+ const diagnosticRules_1 = require("../common/diagnosticRules");
18
+ const localize_1 = require("../localization/localize");
19
+ const analyzerNodeInfo_1 = require("./analyzerNodeInfo");
20
+ const constraintSolver_1 = require("./constraintSolver");
21
+ const constructorTransform_1 = require("./constructorTransform");
22
+ const parseTreeUtils_1 = require("./parseTreeUtils");
23
+ const typeUtils_1 = require("./typeUtils");
24
+ const typeVarContext_1 = require("./typeVarContext");
25
+ const types_1 = require("./types");
26
+ // Matches the arguments of a call to the constructor for a class.
27
+ // If successful, it returns the resulting (specialized) object type that
28
+ // is allocated by the constructor. If unsuccessful, it reports diagnostics.
29
+ function validateConstructorArguments(evaluator, errorNode, argList, type, skipUnknownArgCheck, inferenceContext) {
30
+ // If there a custom `__call__` method on the metaclass, assume that it
31
+ // overrides the normal `type.__call__` logic and don't perform the usual
32
+ // __new__ and __init__ validation.
33
+ const metaclassResult = validateMetaclassCall(evaluator, errorNode, argList, type, skipUnknownArgCheck, inferenceContext);
34
+ if (metaclassResult) {
35
+ return metaclassResult;
36
+ }
37
+ // Determine whether the class overrides the object.__new__ method.
38
+ const newMethodTypeResult = evaluator.getTypeOfClassMemberName(errorNode, type,
39
+ /* isAccessedThroughObject */ false, '__new__', { method: 'get' },
40
+ /* diag */ undefined, 1 /* AccessClassMembersOnly */ |
41
+ 4 /* SkipObjectBaseClass */ |
42
+ 16 /* TreatConstructorAsClassMethod */, type);
43
+ let returnType;
44
+ let validatedArgExpressions = false;
45
+ let argumentErrors = false;
46
+ let isTypeIncomplete = false;
47
+ const overloadsUsedForCall = [];
48
+ let newMethodReturnType;
49
+ const useConstructorTransform = (0, constructorTransform_1.hasConstructorTransform)(type);
50
+ // If there is a constructor transform, evaluate all arguments speculatively
51
+ // so we can later re-evaluate them in the context of the transform.
52
+ evaluator.useSpeculativeMode(useConstructorTransform ? errorNode : undefined, () => {
53
+ var _a;
54
+ // Validate __new__ if it is present.
55
+ if (newMethodTypeResult) {
56
+ // Use speculative mode for arg expressions because we don't know whether
57
+ // we'll need to re-evaluate these expressions later for __init__.
58
+ const newCallResult = validateNewMethod(evaluator, errorNode, argList, type, skipUnknownArgCheck, inferenceContext, newMethodTypeResult,
59
+ /* useSpeculativeModeForArgs */ true);
60
+ if (newCallResult.argumentErrors) {
61
+ argumentErrors = true;
62
+ }
63
+ else {
64
+ overloadsUsedForCall.push(...newCallResult.overloadsUsedForCall);
65
+ }
66
+ if (newCallResult.isTypeIncomplete) {
67
+ isTypeIncomplete = true;
68
+ }
69
+ newMethodReturnType = newCallResult.returnType;
70
+ }
71
+ if (!newMethodReturnType) {
72
+ newMethodReturnType = types_1.ClassType.cloneAsInstance(type);
73
+ }
74
+ else if (!(0, types_1.isNever)(newMethodReturnType)) {
75
+ if (!(0, types_1.isClassInstance)(newMethodReturnType)) {
76
+ // If the __new__ method returns something other than an object or
77
+ // NoReturn, we'll ignore its return type.
78
+ newMethodReturnType = types_1.ClassType.cloneAsInstance(type);
79
+ }
80
+ else if (types_1.ClassType.isSameGenericClass(newMethodReturnType, type) &&
81
+ (0, typeUtils_1.isPartlyUnknown)(newMethodReturnType)) {
82
+ // If the __new__ method returns the same type as the class it's constructing
83
+ // but doesn't supply solved type arguments, we'll ignore its return type
84
+ // and rely on the __init__ method to supply them instead.
85
+ newMethodReturnType = types_1.ClassType.cloneAsInstance(type);
86
+ }
87
+ }
88
+ let initMethodTypeResult;
89
+ // Validate __init__ if it's present. Skip if the __new__ method produced errors.
90
+ if (!argumentErrors &&
91
+ !(0, types_1.isNever)(newMethodReturnType) &&
92
+ !shouldSkipInitEvaluation(evaluator, type, newMethodReturnType)) {
93
+ // Determine whether the class overrides the object.__init__ method.
94
+ initMethodTypeResult = evaluator.getTypeOfObjectMember(errorNode, types_1.ClassType.cloneAsInstance(newMethodReturnType), '__init__', { method: 'get' },
95
+ /* diag */ undefined, 4 /* SkipObjectBaseClass */ | 64 /* SkipAttributeAccessOverride */);
96
+ // Validate __init__ if it's present.
97
+ if (initMethodTypeResult) {
98
+ const initCallResult = validateInitMethod(evaluator, errorNode, argList, newMethodReturnType, skipUnknownArgCheck, inferenceContext, initMethodTypeResult.type);
99
+ if (initCallResult.argumentErrors) {
100
+ argumentErrors = true;
101
+ }
102
+ else {
103
+ overloadsUsedForCall.push(...initCallResult.overloadsUsedForCall);
104
+ }
105
+ if (initCallResult.isTypeIncomplete) {
106
+ isTypeIncomplete = true;
107
+ }
108
+ returnType = initCallResult.returnType;
109
+ validatedArgExpressions = true;
110
+ skipUnknownArgCheck = true;
111
+ }
112
+ }
113
+ if (!validatedArgExpressions && newMethodTypeResult) {
114
+ // If we skipped the __init__ method and the __new__ method was evaluated only
115
+ // speculatively, evaluate it non-speculatively now so we can report errors.
116
+ if (!evaluator.isSpeculativeModeInUse(errorNode)) {
117
+ validateNewMethod(evaluator, errorNode, argList, type, skipUnknownArgCheck, inferenceContext, newMethodTypeResult,
118
+ /* useSpeculativeModeForArgs */ false);
119
+ }
120
+ validatedArgExpressions = true;
121
+ returnType = newMethodReturnType;
122
+ }
123
+ // If the class doesn't override object.__new__ or object.__init__, use the
124
+ // fallback constructor type evaluation for the `object` class.
125
+ if (!newMethodTypeResult && !initMethodTypeResult) {
126
+ const callResult = validateFallbackConstructorCall(evaluator, errorNode, argList, type, inferenceContext);
127
+ if (callResult.argumentErrors) {
128
+ argumentErrors = true;
129
+ }
130
+ else {
131
+ overloadsUsedForCall.push(...callResult.overloadsUsedForCall);
132
+ }
133
+ if (callResult.isTypeIncomplete) {
134
+ isTypeIncomplete = true;
135
+ }
136
+ returnType = (_a = callResult.returnType) !== null && _a !== void 0 ? _a : types_1.UnknownType.create();
137
+ }
138
+ });
139
+ // Apply a constructor transform if applicable.
140
+ if (!argumentErrors && returnType && useConstructorTransform) {
141
+ const transformed = (0, constructorTransform_1.applyConstructorTransform)(evaluator, errorNode, argList, type, {
142
+ argumentErrors,
143
+ returnType,
144
+ isTypeIncomplete,
145
+ });
146
+ returnType = transformed.returnType;
147
+ if (transformed.isTypeIncomplete) {
148
+ isTypeIncomplete = true;
149
+ }
150
+ if (transformed.argumentErrors) {
151
+ argumentErrors = true;
152
+ }
153
+ validatedArgExpressions = true;
154
+ }
155
+ // If we weren't able to validate the args, analyze the expressions here
156
+ // to mark symbols referenced and report expression evaluation errors.
157
+ if (!validatedArgExpressions) {
158
+ argList.forEach((arg) => {
159
+ if (arg.valueExpression && !evaluator.isSpeculativeModeInUse(arg.valueExpression)) {
160
+ evaluator.getTypeOfExpression(arg.valueExpression);
161
+ }
162
+ });
163
+ }
164
+ return { argumentErrors, returnType, isTypeIncomplete, overloadsUsedForCall };
165
+ }
166
+ exports.validateConstructorArguments = validateConstructorArguments;
167
+ // Evaluates the __new__ method for type correctness. If useSpeculativeModeForArgs
168
+ // is true, use speculative mode to evaluate the arguments (unless an argument
169
+ // error is produced, in which case it's OK to use speculative mode).
170
+ function validateNewMethod(evaluator, errorNode, argList, type, skipUnknownArgCheck, inferenceContext, newMethodTypeResult, useSpeculativeModeForArgs) {
171
+ let newReturnType;
172
+ let isTypeIncomplete = false;
173
+ let argumentErrors = false;
174
+ const overloadsUsedForCall = [];
175
+ const typeVarContext = new typeVarContext_1.TypeVarContext((0, typeUtils_1.getTypeVarScopeId)(type));
176
+ typeVarContext.addSolveForScope((0, typeUtils_1.getTypeVarScopeId)(newMethodTypeResult.type));
177
+ if (type.typeAliasInfo) {
178
+ typeVarContext.addSolveForScope(type.typeAliasInfo.typeVarScopeId);
179
+ }
180
+ const callResult = evaluator.useSpeculativeMode(useSpeculativeModeForArgs ? errorNode : undefined, () => {
181
+ return evaluator.validateCallArguments(errorNode, argList, newMethodTypeResult, typeVarContext, skipUnknownArgCheck, inferenceContext);
182
+ });
183
+ if (callResult.isTypeIncomplete) {
184
+ isTypeIncomplete = true;
185
+ }
186
+ if (callResult.argumentErrors) {
187
+ argumentErrors = true;
188
+ // Evaluate the arguments in a non-speculative manner to generate any diagnostics.
189
+ evaluator.validateCallArguments(errorNode, argList, newMethodTypeResult, typeVarContext, skipUnknownArgCheck);
190
+ }
191
+ else {
192
+ newReturnType = callResult.returnType;
193
+ if (overloadsUsedForCall.length === 0) {
194
+ overloadsUsedForCall.push(...callResult.overloadsUsedForCall);
195
+ }
196
+ // If the constructor returned an object whose type matches the class of
197
+ // the original type being constructed, use the return type in case it was
198
+ // specialized. If it doesn't match, we'll fall back on the assumption that
199
+ // the constructed type is an instance of the class type. We need to do this
200
+ // in cases where we're inferring the return type based on a call to
201
+ // super().__new__().
202
+ if (newReturnType) {
203
+ if ((0, types_1.isClassInstance)(newReturnType) && types_1.ClassType.isSameGenericClass(newReturnType, type)) {
204
+ // If the specialized return type derived from the __init__
205
+ // method is "better" than the return type provided by the
206
+ // __new__ method (where "better" means that the type arguments
207
+ // are all known), stick with the __init__ result.
208
+ if (!(0, typeUtils_1.isPartlyUnknown)(newReturnType) && !(0, typeUtils_1.requiresSpecialization)(newReturnType)) {
209
+ // Special-case the 'tuple' type specialization to use
210
+ // the homogenous arbitrary-length form.
211
+ if ((0, types_1.isClassInstance)(newReturnType) &&
212
+ types_1.ClassType.isTupleClass(newReturnType) &&
213
+ !newReturnType.tupleTypeArguments &&
214
+ newReturnType.typeArguments &&
215
+ newReturnType.typeArguments.length === 1) {
216
+ newReturnType = (0, typeUtils_1.specializeTupleClass)(newReturnType, [
217
+ { type: newReturnType.typeArguments[0], isUnbounded: true },
218
+ ]);
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }
224
+ if (!newReturnType) {
225
+ newReturnType = applyExpectedTypeForConstructor(evaluator, type, inferenceContext, typeVarContext);
226
+ }
227
+ else if ((0, types_1.isClassInstance)(newReturnType) && (0, typeUtils_1.isTupleClass)(newReturnType) && !newReturnType.tupleTypeArguments) {
228
+ newReturnType = applyExpectedTypeForTupleConstructor(newReturnType, inferenceContext);
229
+ }
230
+ return { argumentErrors, returnType: newReturnType, isTypeIncomplete, overloadsUsedForCall };
231
+ }
232
+ function validateInitMethod(evaluator, errorNode, argList, type, skipUnknownArgCheck, inferenceContext, initMethodType) {
233
+ let returnType;
234
+ let isTypeIncomplete = false;
235
+ let argumentErrors = false;
236
+ const overloadsUsedForCall = [];
237
+ // If there is an expected type, analyze the __init__ call for each of the
238
+ // subtypes that comprise the expected type. If one or more analyzes with no
239
+ // errors, use those results. This requires special-case processing because
240
+ // the __init__ method doesn't return the expected type. It always
241
+ // returns None.
242
+ if (inferenceContext) {
243
+ returnType = (0, typeUtils_1.mapSubtypes)(inferenceContext.expectedType, (expectedSubType) => {
244
+ expectedSubType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(expectedSubType);
245
+ const typeVarContext = new typeVarContext_1.TypeVarContext((0, typeUtils_1.getTypeVarScopeId)(type));
246
+ typeVarContext.addSolveForScope((0, typeUtils_1.getTypeVarScopeId)(initMethodType));
247
+ if ((0, constraintSolver_1.populateTypeVarContextBasedOnExpectedType)(evaluator, types_1.ClassType.cloneAsInstance(type), expectedSubType, typeVarContext, (0, parseTreeUtils_1.getTypeVarScopesForNode)(errorNode))) {
248
+ const specializedConstructor = (0, typeUtils_1.applySolvedTypeVars)(initMethodType, typeVarContext);
249
+ let callResult;
250
+ callResult = evaluator.useSpeculativeMode(errorNode, () => {
251
+ return evaluator.validateCallArguments(errorNode, argList, { type: specializedConstructor }, typeVarContext.clone(), skipUnknownArgCheck);
252
+ });
253
+ if (!callResult.argumentErrors) {
254
+ // Call validateCallArguments again, this time without speculative
255
+ // mode, so any errors are reported.
256
+ callResult = evaluator.validateCallArguments(errorNode, argList, { type: specializedConstructor }, typeVarContext, skipUnknownArgCheck);
257
+ if (callResult.isTypeIncomplete) {
258
+ isTypeIncomplete = true;
259
+ }
260
+ if (callResult.argumentErrors) {
261
+ argumentErrors = true;
262
+ }
263
+ overloadsUsedForCall.push(...callResult.overloadsUsedForCall);
264
+ return applyExpectedSubtypeForConstructor(evaluator, type, expectedSubType, typeVarContext);
265
+ }
266
+ }
267
+ return undefined;
268
+ });
269
+ if ((0, types_1.isNever)(returnType) || argumentErrors) {
270
+ returnType = undefined;
271
+ }
272
+ }
273
+ if (!returnType) {
274
+ const typeVarContext = type.typeArguments
275
+ ? (0, typeUtils_1.buildTypeVarContextFromSpecializedClass)(type, /* makeConcrete */ false)
276
+ : new typeVarContext_1.TypeVarContext((0, typeUtils_1.getTypeVarScopeId)(type));
277
+ typeVarContext.addSolveForScope((0, typeUtils_1.getTypeVarScopeId)(initMethodType));
278
+ const callResult = evaluator.validateCallArguments(errorNode, argList, { type: initMethodType }, typeVarContext, skipUnknownArgCheck);
279
+ let adjustedClassType = type;
280
+ if (callResult.specializedInitSelfType &&
281
+ (0, types_1.isClassInstance)(callResult.specializedInitSelfType) &&
282
+ types_1.ClassType.isSameGenericClass(callResult.specializedInitSelfType, adjustedClassType)) {
283
+ adjustedClassType = types_1.ClassType.cloneAsInstantiable(callResult.specializedInitSelfType);
284
+ }
285
+ returnType = applyExpectedTypeForConstructor(evaluator, adjustedClassType,
286
+ /* inferenceContext */ undefined, typeVarContext);
287
+ if (callResult.isTypeIncomplete) {
288
+ isTypeIncomplete = true;
289
+ }
290
+ if (callResult.argumentErrors) {
291
+ argumentErrors = true;
292
+ }
293
+ else {
294
+ overloadsUsedForCall.push(...callResult.overloadsUsedForCall);
295
+ }
296
+ }
297
+ return { argumentErrors, returnType, isTypeIncomplete, overloadsUsedForCall };
298
+ }
299
+ function validateFallbackConstructorCall(evaluator, errorNode, argList, type, inferenceContext) {
300
+ let reportedErrors = false;
301
+ if (argList.length > 0) {
302
+ const fileInfo = (0, analyzerNodeInfo_1.getFileInfo)(errorNode);
303
+ evaluator.addDiagnostic(fileInfo.diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.Localizer.Diagnostic.constructorNoArgs().format({ type: type.aliasName || type.details.name }), errorNode);
304
+ reportedErrors = true;
305
+ }
306
+ if (!inferenceContext && type.typeArguments) {
307
+ // If there was no expected type but the type was already specialized,
308
+ // assume that we're constructing an instance of the specialized type.
309
+ return {
310
+ argumentErrors: reportedErrors,
311
+ overloadsUsedForCall: [],
312
+ returnType: (0, typeUtils_1.convertToInstance)(type),
313
+ };
314
+ }
315
+ // Do our best to specialize the instantiated class based on the expected
316
+ // type if provided.
317
+ const typeVarContext = new typeVarContext_1.TypeVarContext((0, typeUtils_1.getTypeVarScopeId)(type));
318
+ if (inferenceContext) {
319
+ (0, constraintSolver_1.populateTypeVarContextBasedOnExpectedType)(evaluator, types_1.ClassType.cloneAsInstance(type), inferenceContext.expectedType, typeVarContext, (0, parseTreeUtils_1.getTypeVarScopesForNode)(errorNode));
320
+ }
321
+ return {
322
+ argumentErrors: reportedErrors,
323
+ overloadsUsedForCall: [],
324
+ returnType: applyExpectedTypeForConstructor(evaluator, type, inferenceContext, typeVarContext),
325
+ };
326
+ }
327
+ function validateMetaclassCall(evaluator, errorNode, argList, type, skipUnknownArgCheck, inferenceContext) {
328
+ const metaclass = type.details.effectiveMetaclass;
329
+ if (metaclass && (0, types_1.isInstantiableClass)(metaclass) && !types_1.ClassType.isSameGenericClass(metaclass, type)) {
330
+ const metaclassCallMethodInfo = evaluator.getTypeOfClassMemberName(errorNode, metaclass,
331
+ /* isAccessedThroughObject */ true, '__call__', { method: 'get' },
332
+ /* diag */ undefined, 32 /* ConsiderMetaclassOnly */ |
333
+ 256 /* SkipTypeBaseClass */ |
334
+ 64 /* SkipAttributeAccessOverride */, type);
335
+ if (metaclassCallMethodInfo) {
336
+ const callResult = evaluator.validateCallArguments(errorNode, argList, metaclassCallMethodInfo,
337
+ /* typeVarContext */ undefined, skipUnknownArgCheck, inferenceContext);
338
+ if (!callResult.returnType || (0, types_1.isUnknown)(callResult.returnType)) {
339
+ // The return result isn't known. We'll assume in this case that
340
+ // the metaclass __call__ method allocated a new instance of the
341
+ // requested class.
342
+ const typeVarContext = new typeVarContext_1.TypeVarContext((0, typeUtils_1.getTypeVarScopeId)(type));
343
+ callResult.returnType = applyExpectedTypeForConstructor(evaluator, type, inferenceContext, typeVarContext);
344
+ }
345
+ return callResult;
346
+ }
347
+ }
348
+ return undefined;
349
+ }
350
+ function applyExpectedSubtypeForConstructor(evaluator, type, expectedSubtype, typeVarContext) {
351
+ const specializedType = (0, typeUtils_1.applySolvedTypeVars)(types_1.ClassType.cloneAsInstance(type), typeVarContext, {
352
+ applyInScopePlaceholders: true,
353
+ });
354
+ if (!evaluator.assignType(expectedSubtype, specializedType)) {
355
+ return undefined;
356
+ }
357
+ // If the expected type is "Any", transform it to an Any.
358
+ if ((0, types_1.isAny)(expectedSubtype)) {
359
+ return expectedSubtype;
360
+ }
361
+ return specializedType;
362
+ }
363
+ // Handles the case where a constructor is a generic type and the type
364
+ // arguments are not specified but can be provided by the expected type.
365
+ function applyExpectedTypeForConstructor(evaluator, type, inferenceContext, typeVarContext) {
366
+ let unsolvedTypeVarsAreUnknown = true;
367
+ if (inferenceContext) {
368
+ const specializedExpectedType = (0, typeUtils_1.mapSubtypes)(inferenceContext.expectedType, (expectedSubtype) => {
369
+ return applyExpectedSubtypeForConstructor(evaluator, type, expectedSubtype, typeVarContext);
370
+ });
371
+ if (!(0, types_1.isNever)(specializedExpectedType)) {
372
+ return specializedExpectedType;
373
+ }
374
+ // If the expected type didn't provide TypeVar values, remaining
375
+ // unsolved TypeVars should be considered Unknown unless they were
376
+ // provided explicitly in the constructor call.
377
+ if (type.typeArguments) {
378
+ unsolvedTypeVarsAreUnknown = false;
379
+ }
380
+ }
381
+ const specializedType = (0, typeUtils_1.applySolvedTypeVars)(type, typeVarContext, {
382
+ unknownIfNotFound: unsolvedTypeVarsAreUnknown,
383
+ });
384
+ return types_1.ClassType.cloneAsInstance(specializedType);
385
+ }
386
+ // Similar to applyExpectedTypeForConstructor, this function handles the
387
+ // special case of the tuple class.
388
+ function applyExpectedTypeForTupleConstructor(type, inferenceContext) {
389
+ let specializedType = type;
390
+ if (inferenceContext &&
391
+ (0, types_1.isClassInstance)(inferenceContext.expectedType) &&
392
+ (0, typeUtils_1.isTupleClass)(inferenceContext.expectedType) &&
393
+ inferenceContext.expectedType.tupleTypeArguments) {
394
+ specializedType = (0, typeUtils_1.specializeTupleClass)(type, inferenceContext.expectedType.tupleTypeArguments);
395
+ }
396
+ return specializedType;
397
+ }
398
+ // Synthesize a function that represents the constructor for this class
399
+ // taking into consideration the __init__ and __new__ methods.
400
+ function createFunctionFromConstructor(evaluator, classType, recursionCount = 0) {
401
+ // Use the __init__ method if available. It's usually more detailed.
402
+ const initInfo = (0, typeUtils_1.lookUpClassMember)(classType, '__init__', 8 /* SkipInstanceVariables */ | 4 /* SkipObjectBaseClass */);
403
+ if (initInfo) {
404
+ const initType = evaluator.getTypeOfMember(initInfo);
405
+ const objectType = types_1.ClassType.cloneAsInstance(classType);
406
+ const convertInitToConstructor = (initSubtype) => {
407
+ let constructorFunction = evaluator.bindFunctionToClassOrObject(objectType, initSubtype,
408
+ /* memberClass */ undefined,
409
+ /* errorNode */ undefined, recursionCount);
410
+ if (constructorFunction) {
411
+ constructorFunction = types_1.FunctionType.clone(constructorFunction);
412
+ constructorFunction.details.declaredReturnType = objectType;
413
+ if (constructorFunction.specializedTypes) {
414
+ constructorFunction.specializedTypes.returnType = objectType;
415
+ }
416
+ if (!constructorFunction.details.docString && classType.details.docString) {
417
+ constructorFunction.details.docString = classType.details.docString;
418
+ }
419
+ constructorFunction.details.flags &= ~4 /* StaticMethod */;
420
+ }
421
+ return constructorFunction;
422
+ };
423
+ if ((0, types_1.isFunction)(initType)) {
424
+ return convertInitToConstructor(initType);
425
+ }
426
+ else if ((0, types_1.isOverloadedFunction)(initType)) {
427
+ const initOverloads = [];
428
+ initType.overloads.forEach((overload) => {
429
+ const converted = convertInitToConstructor(overload);
430
+ if (converted) {
431
+ initOverloads.push(converted);
432
+ }
433
+ });
434
+ if (initOverloads.length === 0) {
435
+ return undefined;
436
+ }
437
+ else if (initOverloads.length === 1) {
438
+ return initOverloads[0];
439
+ }
440
+ return types_1.OverloadedFunctionType.create(initOverloads);
441
+ }
442
+ }
443
+ // Fall back on the __new__ method if __init__ isn't available.
444
+ const newInfo = (0, typeUtils_1.lookUpClassMember)(classType, '__new__', 8 /* SkipInstanceVariables */ | 4 /* SkipObjectBaseClass */);
445
+ if (newInfo) {
446
+ const newType = evaluator.getTypeOfMember(newInfo);
447
+ const convertNewToConstructor = (newSubtype) => {
448
+ let constructorFunction = evaluator.bindFunctionToClassOrObject(classType, newSubtype,
449
+ /* memberClass */ undefined,
450
+ /* errorNode */ undefined, recursionCount,
451
+ /* treatConstructorAsClassMember */ true);
452
+ if (constructorFunction) {
453
+ constructorFunction = types_1.FunctionType.clone(constructorFunction);
454
+ if (!constructorFunction.details.docString && classType.details.docString) {
455
+ constructorFunction.details.docString = classType.details.docString;
456
+ }
457
+ constructorFunction.details.flags &= ~(4 /* StaticMethod */ | 1 /* ConstructorMethod */);
458
+ }
459
+ return constructorFunction;
460
+ };
461
+ if ((0, types_1.isFunction)(newType)) {
462
+ return convertNewToConstructor(newType);
463
+ }
464
+ else if ((0, types_1.isOverloadedFunction)(newType)) {
465
+ const newOverloads = [];
466
+ newType.overloads.forEach((overload) => {
467
+ const converted = convertNewToConstructor(overload);
468
+ if (converted) {
469
+ newOverloads.push(converted);
470
+ }
471
+ });
472
+ if (newOverloads.length === 0) {
473
+ return undefined;
474
+ }
475
+ else if (newOverloads.length === 1) {
476
+ return newOverloads[0];
477
+ }
478
+ return types_1.OverloadedFunctionType.create(newOverloads);
479
+ }
480
+ }
481
+ // Return a generic constructor.
482
+ const constructorFunction = types_1.FunctionType.createSynthesizedInstance('__new__', 0 /* None */);
483
+ constructorFunction.details.declaredReturnType = types_1.ClassType.cloneAsInstance(classType);
484
+ types_1.FunctionType.addDefaultParameters(constructorFunction);
485
+ if (!constructorFunction.details.docString && classType.details.docString) {
486
+ constructorFunction.details.docString = classType.details.docString;
487
+ }
488
+ return constructorFunction;
489
+ }
490
+ exports.createFunctionFromConstructor = createFunctionFromConstructor;
491
+ // If __new__ returns a type that is not an instance of the class, skip the
492
+ // __init__ method evaluation. This is consistent with the behavior of the
493
+ // type.__call__ runtime behavior.
494
+ function shouldSkipInitEvaluation(evaluator, classType, newMethodReturnType) {
495
+ const returnType = evaluator.makeTopLevelTypeVarsConcrete(newMethodReturnType);
496
+ let skipInitCheck = false;
497
+ (0, typeUtils_1.doForEachSubtype)(returnType, (subtype) => {
498
+ if ((0, types_1.isAnyOrUnknown)(subtype)) {
499
+ return;
500
+ }
501
+ if ((0, types_1.isClassInstance)(subtype)) {
502
+ const inheritanceChain = [];
503
+ const isDerivedFrom = types_1.ClassType.isDerivedFrom(subtype, classType, inheritanceChain);
504
+ if (!isDerivedFrom) {
505
+ skipInitCheck = true;
506
+ }
507
+ return;
508
+ }
509
+ skipInitCheck = true;
510
+ });
511
+ return skipInitCheck;
512
+ }
513
+ //# sourceMappingURL=constructors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constructors.js","sourceRoot":"","sources":["../../../src/analyzer/constructors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,+DAA2D;AAC3D,uDAAqD;AAErD,yDAAiD;AACjD,yDAA+E;AAC/E,iEAA4F;AAC5F,qDAA2D;AAE3D,2CAeqB;AACrB,qDAAkD;AAClD,mCAgBiB;AAEjB,kEAAkE;AAClE,yEAAyE;AACzE,4EAA4E;AAC5E,SAAgB,4BAA4B,CACxC,SAAwB,EACxB,SAAyB,EACzB,OAA2B,EAC3B,IAAe,EACf,mBAA4B,EAC5B,gBAA8C;IAE9C,uEAAuE;IACvE,yEAAyE;IACzE,mCAAmC;IACnC,MAAM,eAAe,GAAG,qBAAqB,CACzC,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EACJ,mBAAmB,EACnB,gBAAgB,CACnB,CAAC;IACF,IAAI,eAAe,EAAE;QACjB,OAAO,eAAe,CAAC;KAC1B;IAED,mEAAmE;IACnE,MAAM,mBAAmB,GAAG,SAAS,CAAC,wBAAwB,CAC1D,SAAS,EACT,IAAI;IACJ,6BAA6B,CAAC,KAAK,EACnC,SAAS,EACT,EAAE,MAAM,EAAE,KAAK,EAAE;IACjB,UAAU,CAAC,SAAS,EACpB;mCACyC;8CACU,EACnD,IAAI,CACP,CAAC;IAEF,IAAI,UAA4B,CAAC;IACjC,IAAI,uBAAuB,GAAG,KAA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