Skip to content

Commit 5a07823

Browse files
committed
remove unnecessary code
1 parent c9f2625 commit 5a07823

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

crates/ty_python_semantic/src/semantic_index/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ impl<'db, 'ast> SemanticIndexBuilder<'db, 'ast> {
504504

505505
if popped_scope.is_eager() {
506506
self.record_eager_snapshots(popped_scope_id);
507-
} else {
507+
} else if !popped_scope.kind().is_type_alias() {
508+
// Don't record lazy snapshots in a type alias scope, as it is a deferred evaluation context.
508509
self.record_lazy_snapshots(popped_scope_id);
509510
}
510511

crates/ty_python_semantic/src/semantic_index/scope.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ impl ScopeKind {
263263
matches!(self, ScopeKind::TypeParams | ScopeKind::TypeAlias)
264264
}
265265

266+
pub(crate) const fn is_type_alias(self) -> bool {
267+
matches!(self, ScopeKind::TypeAlias)
268+
}
269+
266270
pub(crate) const fn is_non_lambda_function(self) -> bool {
267271
matches!(self, ScopeKind::Function)
268272
}

crates/ty_python_semantic/src/types/infer.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6779,12 +6779,6 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
67796779
bindings,
67806780
SnapshotCompleteness::Complete,
67816781
) => {
6782-
if place_expr.is_symbol()
6783-
&& !enclosing_scope_id.is_function_like(db)
6784-
&& !is_immediately_enclosing_scope
6785-
{
6786-
continue;
6787-
}
67886782
let place = place_from_bindings(db, bindings).map_type(|ty| {
67896783
self.narrow_place_with_applicable_constraints(
67906784
place_expr,
@@ -6802,12 +6796,6 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
68026796
_,
68036797
SnapshotCompleteness::Incomplete(_, snapshot),
68046798
) => {
6805-
if place_expr.is_symbol()
6806-
&& !enclosing_scope_id.is_function_like(db)
6807-
&& !is_immediately_enclosing_scope
6808-
{
6809-
continue;
6810-
}
68116799
considered_definitions =
68126800
ConsideredDefinitions::AllReachable(Some(snapshot));
68136801
}

0 commit comments

Comments
 (0)