diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index bc9fa55d6e..8c1e36bdcf 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -90,12 +90,10 @@ fn symbol_by_id<'db>(db: &'db dyn Db, scope: ScopeId<'db>, symbol: ScopedSymbolI match inferred_ty { // Symbol is possibly undeclared and definitely unbound Symbol::Unbound => Symbol::Type(declared_ty, Boundness::Bound), - // Symbol is possibly undeclared and definitely bound - inferred @ Symbol::Type(_, Boundness::Bound) => inferred, - // Symbol is possibly undeclared and possibly unbound - Symbol::Type(inferred_ty, Boundness::PossiblyUnbound) => Symbol::Type( - UnionType::from_elements(db, [declared_ty, inferred_ty].iter().copied()), - Boundness::PossiblyUnbound, + // Symbol is possibly undeclared and (possibly) bound + Symbol::Type(inferred_ty, boundness) => Symbol::Type( + UnionType::from_elements(db, [inferred_ty, declared_ty].iter().copied()), + boundness, ), } }