diff --git a/crates/red_knot_python_semantic/resources/mdtest/import/conditional.md b/crates/red_knot_python_semantic/resources/mdtest/import/conditional.md index 0adb7ab83a..79686f8e74 100644 --- a/crates/red_knot_python_semantic/resources/mdtest/import/conditional.md +++ b/crates/red_knot_python_semantic/resources/mdtest/import/conditional.md @@ -69,8 +69,6 @@ if coinflip(): ``` ```py -# TODO: We should potentially distinguish between possibly-unbound and possibly-undeclared here: -# error: [possibly-unbound-import] from maybe_undeclared import x reveal_type(x) # revealed: int diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index 226174bcb2..7421f23677 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -90,7 +90,12 @@ fn symbol_by_id<'db>(db: &'db dyn Db, scope: ScopeId<'db>, symbol: ScopedSymbolI match inferred { // Symbol is possibly undeclared and definitely unbound - Symbol::Unbound => Symbol::Type(declared_ty, Boundness::PossiblyUnbound), + Symbol::Unbound => { + // TODO: We probably don't want to report `Bound` here. This requires a bit of + // design work though as we might want a different behavior for stubs and for + // normal modules. + Symbol::Type(declared_ty, Boundness::Bound) + } // Symbol is possibly undeclared and (possibly) bound Symbol::Type(inferred_ty, boundness) => Symbol::Type( UnionType::from_elements(db, [inferred_ty, declared_ty].iter().copied()),