diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index 21278a4232..7baf170c91 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -594,9 +594,8 @@ impl<'db> Type<'db> { CallOutcome::callable(if is_bool { arg_types .first() - .unwrap_or(&Type::Unknown) - .bool(db) - .into_type(db) + .map(|arg| arg.bool(db).into_type(db)) + .unwrap_or(Type::BooleanLiteral(false)) } else { Type::Instance(class) }) diff --git a/crates/red_knot_python_semantic/src/types/infer.rs b/crates/red_knot_python_semantic/src/types/infer.rs index b2a0c3d768..1894283c09 100644 --- a/crates/red_knot_python_semantic/src/types/infer.rs +++ b/crates/red_knot_python_semantic/src/types/infer.rs @@ -6494,6 +6494,7 @@ mod tests { c = bool(None) d = bool("") e = bool(False) + f = bool() "#, )?; assert_public_ty(&db, "/src/a.py", "a", "Literal[False]"); @@ -6501,6 +6502,7 @@ mod tests { assert_public_ty(&db, "/src/a.py", "c", "Literal[False]"); assert_public_ty(&db, "/src/a.py", "d", "Literal[False]"); assert_public_ty(&db, "/src/a.py", "e", "Literal[False]"); + assert_public_ty(&db, "/src/a.py", "f", "Literal[False]"); Ok(()) }