Skip to content

Commit

Permalink
Update crates/red_knot_python_semantic/src/types/infer.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Carl Meyer <carl@oddbird.net>
  • Loading branch information
Glyphack and carljm committed Dec 19, 2024
1 parent 6bc16e2 commit 9689544
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/red_knot_python_semantic/src/types/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,10 @@ impl<'db> TypeInferenceBuilder<'db> {
let inferred_ty = if let Some(default_ty) = default_ty {
if default_ty.is_assignable_to(self.db(), declared_ty) {
UnionType::from_elements(self.db(), [declared_ty, default_ty])
} else if default
.as_ref()
.is_some_and(|d| d.is_ellipsis_literal_expr())
} else if self.file.is_stub(self.db.upcast())
&& default
.as_ref()
.is_some_and(|d| d.is_ellipsis_literal_expr())
{
declared_ty
} else {
Expand Down

0 comments on commit 9689544

Please sign in to comment.