Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[red-knot] fix scope inference with deferred types #13204

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clippy
  • Loading branch information
carljm committed Sep 3, 2024
commit 8d085c6aec0cd9cb136a74a9e0ec5f8369025266
12 changes: 6 additions & 6 deletions crates/red_knot_python_semantic/src/types/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,10 @@ impl<'db> TypeInferenceBuilder<'db> {
self.infer_parameters(parameters);

// TODO: this should also be applied to parameter annotations.
if !self.is_stub() {
self.infer_optional_annotation_expression(returns.as_deref());
} else {
if self.is_stub() {
self.types.has_deferred = true;
} else {
self.infer_optional_annotation_expression(returns.as_deref());
}
}

Expand Down Expand Up @@ -683,12 +683,12 @@ impl<'db> TypeInferenceBuilder<'db> {

// inference of bases deferred in stubs
// TODO also defer stringified generic type parameters
if !self.is_stub() {
if self.is_stub() {
self.types.has_deferred = true;
} else {
for base in class.bases() {
self.infer_expression(base);
}
} else {
self.types.has_deferred = true;
}
}

Expand Down