From 9689544caaa523c563eeb2cfcf03bcd983d4cda5 Mon Sep 17 00:00:00 2001 From: Shaygan Hooshyari Date: Mon, 16 Dec 2024 13:24:49 -0800 Subject: [PATCH] Update crates/red_knot_python_semantic/src/types/infer.rs Co-authored-by: Carl Meyer --- crates/red_knot_python_semantic/src/types/infer.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/red_knot_python_semantic/src/types/infer.rs b/crates/red_knot_python_semantic/src/types/infer.rs index a63b6170738423..6b10b9e8496543 100644 --- a/crates/red_knot_python_semantic/src/types/infer.rs +++ b/crates/red_knot_python_semantic/src/types/infer.rs @@ -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 {