@zzzen/pyright-internal 1.2.0-dev.20230122 → 1.2.0-dev.20230205

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 (244) hide show
  1. package/dist/analyzer/backgroundAnalysisProgram.d.ts +3 -3
  2. package/dist/analyzer/backgroundAnalysisProgram.js +4 -2
  3. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  4. package/dist/analyzer/binder.js +16 -12
  5. package/dist/analyzer/binder.js.map +1 -1
  6. package/dist/analyzer/checker.d.ts +3 -1
  7. package/dist/analyzer/checker.js +63 -20
  8. package/dist/analyzer/checker.js.map +1 -1
  9. package/dist/analyzer/codeFlowEngine.js +3 -2
  10. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  11. package/dist/analyzer/constraintSolver.js +1 -1
  12. package/dist/analyzer/constraintSolver.js.map +1 -1
  13. package/dist/analyzer/dataClasses.js +4 -3
  14. package/dist/analyzer/dataClasses.js.map +1 -1
  15. package/dist/analyzer/declaration.d.ts +2 -0
  16. package/dist/analyzer/declaration.js.map +1 -1
  17. package/dist/analyzer/enums.js +1 -1
  18. package/dist/analyzer/enums.js.map +1 -1
  19. package/dist/analyzer/importResolver.d.ts +1 -1
  20. package/dist/analyzer/importResolver.js +7 -3
  21. package/dist/analyzer/importResolver.js.map +1 -1
  22. package/dist/analyzer/importResult.d.ts +1 -0
  23. package/dist/analyzer/parseTreeUtils.d.ts +2 -1
  24. package/dist/analyzer/parseTreeUtils.js +75 -10
  25. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  26. package/dist/analyzer/patternMatching.js +1 -1
  27. package/dist/analyzer/patternMatching.js.map +1 -1
  28. package/dist/analyzer/program.d.ts +8 -4
  29. package/dist/analyzer/program.js +92 -24
  30. package/dist/analyzer/program.js.map +1 -1
  31. package/dist/analyzer/service.d.ts +0 -2
  32. package/dist/analyzer/service.js +8 -8
  33. package/dist/analyzer/service.js.map +1 -1
  34. package/dist/analyzer/sourceFile.d.ts +4 -8
  35. package/dist/analyzer/sourceFile.js +5 -21
  36. package/dist/analyzer/sourceFile.js.map +1 -1
  37. package/dist/analyzer/typeCacheUtils.d.ts +8 -2
  38. package/dist/analyzer/typeCacheUtils.js +4 -4
  39. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  40. package/dist/analyzer/typeEvaluator.js +247 -110
  41. package/dist/analyzer/typeEvaluator.js.map +1 -1
  42. package/dist/analyzer/typeEvaluatorTypes.d.ts +12 -8
  43. package/dist/analyzer/typeGuards.js +2 -16
  44. package/dist/analyzer/typeGuards.js.map +1 -1
  45. package/dist/analyzer/typeUtils.d.ts +5 -4
  46. package/dist/analyzer/typeUtils.js +41 -14
  47. package/dist/analyzer/typeUtils.js.map +1 -1
  48. package/dist/analyzer/typeVarContext.d.ts +1 -5
  49. package/dist/analyzer/typeVarContext.js +17 -22
  50. package/dist/analyzer/typeVarContext.js.map +1 -1
  51. package/dist/analyzer/typedDicts.js +6 -2
  52. package/dist/analyzer/typedDicts.js.map +1 -1
  53. package/dist/analyzer/types.d.ts +4 -1
  54. package/dist/analyzer/types.js +26 -2
  55. package/dist/analyzer/types.js.map +1 -1
  56. package/dist/backgroundAnalysisBase.d.ts +1 -3
  57. package/dist/backgroundAnalysisBase.js +2 -3
  58. package/dist/backgroundAnalysisBase.js.map +1 -1
  59. package/dist/backgroundThreadBase.js +6 -1
  60. package/dist/backgroundThreadBase.js.map +1 -1
  61. package/dist/common/configOptions.d.ts +5 -0
  62. package/dist/common/configOptions.js +19 -1
  63. package/dist/common/configOptions.js.map +1 -1
  64. package/dist/common/envVarUtils.d.ts +1 -1
  65. package/dist/common/envVarUtils.js +26 -16
  66. package/dist/common/envVarUtils.js.map +1 -1
  67. package/dist/common/extensibility.d.ts +44 -6
  68. package/dist/common/extensibility.js +26 -2
  69. package/dist/common/extensibility.js.map +1 -1
  70. package/dist/common/fullAccessHost.d.ts +2 -1
  71. package/dist/common/fullAccessHost.js +22 -0
  72. package/dist/common/fullAccessHost.js.map +1 -1
  73. package/dist/common/host.d.ts +6 -0
  74. package/dist/common/host.js +3 -0
  75. package/dist/common/host.js.map +1 -1
  76. package/dist/common/pathUtils.d.ts +2 -0
  77. package/dist/common/pathUtils.js +17 -3
  78. package/dist/common/pathUtils.js.map +1 -1
  79. package/dist/languageServerBase.d.ts +4 -5
  80. package/dist/languageServerBase.js +5 -6
  81. package/dist/languageServerBase.js.map +1 -1
  82. package/dist/languageService/callHierarchyProvider.js +1 -1
  83. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  84. package/dist/languageService/completionProvider.d.ts +0 -1
  85. package/dist/languageService/completionProvider.js +21 -99
  86. package/dist/languageService/completionProvider.js.map +1 -1
  87. package/dist/languageService/completionProviderUtils.d.ts +34 -0
  88. package/dist/languageService/completionProviderUtils.js +102 -0
  89. package/dist/languageService/completionProviderUtils.js.map +1 -0
  90. package/dist/languageService/definitionProvider.d.ts +2 -1
  91. package/dist/languageService/definitionProvider.js +25 -9
  92. package/dist/languageService/definitionProvider.js.map +1 -1
  93. package/dist/languageService/documentSymbolCollector.d.ts +2 -1
  94. package/dist/languageService/documentSymbolCollector.js +27 -3
  95. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  96. package/dist/languageService/documentSymbolProvider.js +1 -1
  97. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  98. package/dist/languageService/hoverProvider.d.ts +3 -1
  99. package/dist/languageService/hoverProvider.js +51 -37
  100. package/dist/languageService/hoverProvider.js.map +1 -1
  101. package/dist/languageService/referencesProvider.d.ts +2 -1
  102. package/dist/languageService/referencesProvider.js +4 -3
  103. package/dist/languageService/referencesProvider.js.map +1 -1
  104. package/dist/languageService/tooltipUtils.d.ts +7 -1
  105. package/dist/languageService/tooltipUtils.js +81 -4
  106. package/dist/languageService/tooltipUtils.js.map +1 -1
  107. package/dist/localization/localize.d.ts +7 -0
  108. package/dist/localization/localize.js +9 -9
  109. package/dist/localization/localize.js.map +1 -1
  110. package/dist/localization/package.nls.en-us.json +2 -2
  111. package/dist/parser/parseNodes.js +0 -1
  112. package/dist/parser/parseNodes.js.map +1 -1
  113. package/dist/parser/stringTokenUtils.js +10 -0
  114. package/dist/parser/stringTokenUtils.js.map +1 -1
  115. package/dist/pyright.js +17 -9
  116. package/dist/pyright.js.map +1 -1
  117. package/dist/server.js +2 -0
  118. package/dist/server.js.map +1 -1
  119. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js +1 -1
  120. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
  121. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js +5 -5
  122. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
  123. package/dist/tests/fourslash/completions.commitChars.fourslash.js +23 -1
  124. package/dist/tests/fourslash/completions.commitChars.fourslash.js.map +1 -1
  125. package/dist/tests/fourslash/completions.fourslash.js +2 -2
  126. package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
  127. package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js +1 -1
  128. package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js.map +1 -1
  129. package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js +1 -1
  130. package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js.map +1 -1
  131. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js +1 -1
  132. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
  133. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js +1 -1
  134. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
  135. package/dist/tests/fourslash/completions.libStub.fourslash.js +1 -1
  136. package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
  137. package/dist/tests/fourslash/completions.localCode.fourslash.js +2 -2
  138. package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
  139. package/dist/tests/fourslash/completions.overloads.fourslash.js +1 -1
  140. package/dist/tests/fourslash/completions.overloads.fourslash.js.map +1 -1
  141. package/dist/tests/fourslash/completions.plainText.fourslash.js +2 -2
  142. package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
  143. package/dist/tests/fourslash/completions.self.fourslash.js +2 -2
  144. package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
  145. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js +1 -1
  146. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
  147. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js +2 -2
  148. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
  149. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js +7 -7
  150. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
  151. package/dist/tests/fourslash/hover.class.docString.fourslash.js +1 -1
  152. package/dist/tests/fourslash/hover.class.docString.fourslash.js.map +1 -1
  153. package/dist/tests/fourslash/hover.classNoInit.fourslash.js +1 -1
  154. package/dist/tests/fourslash/hover.classNoInit.fourslash.js.map +1 -1
  155. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js +7 -7
  156. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
  157. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js +1 -1
  158. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
  159. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js +1 -1
  160. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
  161. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js +1 -1
  162. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
  163. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js +1 -1
  164. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
  165. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js +1 -1
  166. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
  167. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js +2 -2
  168. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
  169. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js +1 -1
  170. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
  171. package/dist/tests/fourslash/hover.docstring.links.fourslash.js +1 -1
  172. package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
  173. package/dist/tests/fourslash/hover.docstring.split.fourslash.js +3 -3
  174. package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
  175. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js +1 -1
  176. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -1
  177. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js +1 -1
  178. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -1
  179. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js +1 -1
  180. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -1
  181. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js +1 -1
  182. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -1
  183. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js +1 -1
  184. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -1
  185. package/dist/tests/fourslash/hover.formatted.fourslash.d.ts +1 -0
  186. package/dist/tests/fourslash/hover.formatted.fourslash.js +45 -0
  187. package/dist/tests/fourslash/hover.formatted.fourslash.js.map +1 -0
  188. package/dist/tests/fourslash/hover.fourslash.js +1 -1
  189. package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
  190. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +6 -6
  191. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
  192. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js +5 -5
  193. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
  194. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +4 -4
  195. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
  196. package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js +2 -2
  197. package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js.map +1 -1
  198. package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js +2 -2
  199. package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js.map +1 -1
  200. package/dist/tests/fourslash/hover.init.fourslash.js +4 -4
  201. package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
  202. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js +2 -2
  203. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
  204. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js +2 -2
  205. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
  206. package/dist/tests/fourslash/hover.libStub.fourslash.js +2 -2
  207. package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
  208. package/dist/tests/fourslash/hover.overloadedFunction.fourslash.js +2 -2
  209. package/dist/tests/fourslash/hover.overloadedFunction.fourslash.js.map +1 -1
  210. package/dist/tests/fourslash/hover.plainText.fourslash.js +1 -1
  211. package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
  212. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js +1 -1
  213. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
  214. package/dist/tests/fourslash/import.multipart.fourslash.js +1 -1
  215. package/dist/tests/fourslash/import.multipart.fourslash.js.map +1 -1
  216. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js +1 -1
  217. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
  218. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js +1 -1
  219. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
  220. package/dist/tests/harness/fourslash/testLanguageService.js +2 -1
  221. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  222. package/dist/tests/harness/fourslash/testState.d.ts +0 -10
  223. package/dist/tests/harness/fourslash/testState.js +15 -68
  224. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  225. package/dist/tests/harness/fourslash/testStateUtils.d.ts +12 -0
  226. package/dist/tests/harness/fourslash/testStateUtils.js +98 -0
  227. package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -0
  228. package/dist/tests/pathUtils.test.js +24 -1
  229. package/dist/tests/pathUtils.test.js.map +1 -1
  230. package/dist/tests/signatureHelp.test.d.ts +1 -0
  231. package/dist/tests/signatureHelp.test.js +73 -0
  232. package/dist/tests/signatureHelp.test.js.map +1 -0
  233. package/dist/tests/typeEvaluator1.test.js +16 -0
  234. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  235. package/dist/tests/typeEvaluator2.test.js +8 -0
  236. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  237. package/dist/tests/typeEvaluator3.test.js +5 -1
  238. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  239. package/dist/tests/typeEvaluator4.test.js +15 -1
  240. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  241. package/dist/workspaceMap.d.ts +4 -0
  242. package/dist/workspaceMap.js +67 -37
  243. package/dist/workspaceMap.js.map +1 -1
  244. package/package.json +1 -1
@@ -1,17 +1,4 @@
1
1
  "use strict";
2
- /*
3
- * checker.ts
4
- * Copyright (c) Microsoft Corporation.
5
- * Licensed under the MIT license.
6
- * Author: Eric Traut
7
- *
8
- * A parse tree walker that performs static type checking for
9
- * a source file. Most of its work is performed by the type
10
- * evaluator, but this module touches every node in the file
11
- * to ensure that all statements and expressions are evaluated
12
- * and checked. It also performs some additional checks that
13
- * cannot (or should not be) performed lazily.
14
- */
15
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
3
  if (k2 === undefined) k2 = k;
17
4
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -33,6 +20,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
20
  };
34
21
  Object.defineProperty(exports, "__esModule", { value: true });
35
22
  exports.Checker = void 0;
23
+ /*
24
+ * checker.ts
25
+ * Copyright (c) Microsoft Corporation.
26
+ * Licensed under the MIT license.
27
+ * Author: Eric Traut
28
+ *
29
+ * A parse tree walker that performs static type checking for
30
+ * a source file. Most of its work is performed by the type
31
+ * evaluator, but this module touches every node in the file
32
+ * to ensure that all statements and expressions are evaluated
33
+ * and checked. It also performs some additional checks that
34
+ * cannot (or should not be) performed lazily.
35
+ */
36
+ const vscode_languageserver_1 = require("vscode-languageserver");
36
37
  const debug_1 = require("../common/debug");
37
38
  const diagnostic_1 = require("../common/diagnostic");
38
39
  const diagnosticRules_1 = require("../common/diagnosticRules");
@@ -104,12 +105,13 @@ const deprecatedSpecialForms = new Map([
104
105
  // functions to be emitted.
105
106
  const isPrintCodeComplexityEnabled = false;
106
107
  class Checker extends parseTreeWalker_1.ParseTreeWalker {
107
- constructor(_importResolver, _evaluator, _parseResults, _sourceMapper) {
108
+ constructor(_importResolver, _evaluator, _parseResults, _sourceMapper, _dependentFiles) {
108
109
  super();
109
110
  this._importResolver = _importResolver;
110
111
  this._evaluator = _evaluator;
111
112
  this._parseResults = _parseResults;
112
113
  this._sourceMapper = _sourceMapper;
114
+ this._dependentFiles = _dependentFiles;
113
115
  this._isUnboundCheckSuppressed = false;
114
116
  // A list of all nodes that are defined within the module that
115
117
  // have their own scopes.
@@ -764,6 +766,12 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
764
766
  this._validateComparisonTypes(node);
765
767
  }
766
768
  }
769
+ else if (node.operator === 39 /* Is */ || node.operator === 40 /* IsNot */) {
770
+ // Don't apply this rule if it's within an assert.
771
+ if (!ParseTreeUtils.isWithinAssertExpression(node)) {
772
+ this._validateComparisonTypesForIsOperator(node);
773
+ }
774
+ }
767
775
  else if (node.operator === 41 /* In */ || node.operator === 42 /* NotIn */) {
768
776
  // Don't apply this rule if it's within an assert.
769
777
  if (!ParseTreeUtils.isWithinAssertExpression(node)) {
@@ -1154,6 +1162,36 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
1154
1162
  }), node);
1155
1163
  }
1156
1164
  }
1165
+ // Determines whether the types of the two operands for an "is" or "is not"
1166
+ // operation have overlapping types.
1167
+ _validateComparisonTypesForIsOperator(node) {
1168
+ const rightType = this._evaluator.getType(node.rightExpression);
1169
+ if (!rightType || !(0, types_1.isNoneInstance)(rightType)) {
1170
+ return;
1171
+ }
1172
+ const leftType = this._evaluator.getType(node.leftExpression);
1173
+ if (!leftType) {
1174
+ return;
1175
+ }
1176
+ let foundMatchForNone = false;
1177
+ (0, typeUtils_1.doForEachSubtype)(leftType, (subtype) => {
1178
+ subtype = this._evaluator.makeTopLevelTypeVarsConcrete(subtype);
1179
+ if (this._evaluator.assignType(subtype, types_1.NoneType.createInstance())) {
1180
+ foundMatchForNone = true;
1181
+ }
1182
+ });
1183
+ const getMessage = () => {
1184
+ return node.operator === 39 /* Is */
1185
+ ? localize_1.Localizer.Diagnostic.comparisonAlwaysFalse()
1186
+ : localize_1.Localizer.Diagnostic.comparisonAlwaysTrue();
1187
+ };
1188
+ if (!foundMatchForNone) {
1189
+ this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison, diagnosticRules_1.DiagnosticRule.reportUnnecessaryComparison, getMessage().format({
1190
+ leftType: this._evaluator.printType(leftType, { expandTypeAlias: true }),
1191
+ rightType: this._evaluator.printType(rightType),
1192
+ }), node);
1193
+ }
1194
+ }
1157
1195
  // Determines whether the types of the two operands for an == or != operation
1158
1196
  // have overlapping types.
1159
1197
  _validateComparisonTypes(node) {
@@ -1732,11 +1770,13 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
1732
1770
  });
1733
1771
  }
1734
1772
  _validateSymbolTables() {
1773
+ var _a;
1774
+ const dependentFileInfo = (_a = this._dependentFiles) === null || _a === void 0 ? void 0 : _a.map((p) => AnalyzerNodeInfo.getFileInfo(p.parseTree));
1735
1775
  for (const scopedNode of this._scopedNodes) {
1736
1776
  const scope = AnalyzerNodeInfo.getScope(scopedNode);
1737
1777
  if (scope) {
1738
1778
  scope.symbolTable.forEach((symbol, name) => {
1739
- this._conditionallyReportUnusedSymbol(name, symbol, scope.type);
1779
+ this._conditionallyReportUnusedSymbol(name, symbol, scope.type, dependentFileInfo);
1740
1780
  this._reportIncompatibleDeclarations(name, symbol);
1741
1781
  this._reportMultipleFinalDeclarations(name, symbol, scope.type);
1742
1782
  this._reportMultipleTypeAliasDeclarations(name, symbol);
@@ -2079,11 +2119,14 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2079
2119
  }
2080
2120
  }
2081
2121
  }
2082
- _conditionallyReportUnusedSymbol(name, symbol, scopeType) {
2122
+ _conditionallyReportUnusedSymbol(name, symbol, scopeType, dependentFileInfo) {
2083
2123
  const accessedSymbolSet = this._fileInfo.accessedSymbolSet;
2084
- if (symbol.isIgnoredForProtocolMatch() ||
2085
- accessedSymbolSet.has(symbol.id) ||
2086
- this._fileInfo.ipythonMode === sourceFile_1.IPythonMode.CellDocs) {
2124
+ if (symbol.isIgnoredForProtocolMatch() || accessedSymbolSet.has(symbol.id)) {
2125
+ return;
2126
+ }
2127
+ // If this file is implicitly imported by other files, we need to make sure the symbol defined in
2128
+ // the current file is not accessed from those other files.
2129
+ if (dependentFileInfo && dependentFileInfo.some((i) => i.accessedSymbolSet.has(symbol.id))) {
2087
2130
  return;
2088
2131
  }
2089
2132
  // A name of "_" means "I know this symbol isn't used", so
@@ -2650,7 +2693,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2650
2693
  const stdlibPath = this._importResolver.getTypeshedStdLibPath(this._fileInfo.executionEnvironment);
2651
2694
  if (stdlibPath && this._importResolver.isStdlibModule(module, this._fileInfo.executionEnvironment)) {
2652
2695
  // If the definition for this name is in 'user' module, it is overwriting the stdlib module.
2653
- const definitions = definitionProvider_1.DefinitionProvider.getDefinitionsForNode(this._sourceMapper, namePartNodes[namePartNodes.length - 1], definitionProvider_1.DefinitionFilter.All, this._evaluator);
2696
+ const definitions = definitionProvider_1.DefinitionProvider.getDefinitionsForNode(this._sourceMapper, namePartNodes[namePartNodes.length - 1], definitionProvider_1.DefinitionFilter.All, this._evaluator, vscode_languageserver_1.CancellationToken.None);
2654
2697
  const paths = definitions ? definitions.map((d) => d.path) : [];
2655
2698
  paths.forEach((p) => {
2656
2699
  if (!p.startsWith(stdlibPath) && !(0, sourceMapper_1.isStubFile)(p) && this._sourceMapper.isUserCode(p)) {