Skip to content

Commit e8e1a63

Browse files
authored
Run semantic analysis pass one if file doesn't exsit (#21379)
Noticed this while working on the other fixes from #21331. If file doesn't exist, it will be parsed with the old parser, even if the native parser is enabled, so we need to run semantic analysis pass one on it. Not adding a test because this will not be needed soon (and I am lazy, sorry).
1 parent 07b6443 commit e8e1a63

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mypy/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3314,7 +3314,9 @@ def semantic_analysis_pass1(self) -> None:
33143314
#
33153315
# TODO: This should not be considered as a semantic analysis
33163316
# pass -- it's an independent pass.
3317-
if not options.native_parser:
3317+
if not options.native_parser or not self.manager.fscache.exists(
3318+
self.xpath, real_only=True
3319+
):
33183320
analyzer = SemanticAnalyzerPreAnalysis()
33193321
with self.wrap_context():
33203322
analyzer.visit_file(self.tree, self.xpath, self.id, options)

0 commit comments

Comments
 (0)