From edfaf896e4d68a2da03871774c5f722d8a2f36e2 Mon Sep 17 00:00:00 2001 From: David Peter Date: Tue, 15 Oct 2024 14:09:24 +0200 Subject: [PATCH] Shorten comment regarding union types --- crates/red_knot_python_semantic/src/types.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index b6a99c9acd..8c6e2e7c47 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -496,11 +496,9 @@ impl<'db> Type<'db> { tuple.elements(db).is_empty() } Type::Union(..) => { - // There are some rare edge cases where a union type might be a singleton type. - // For example, a union with just one element (which itself is a singleton). Or - // a union with an empty type (e.g. Never | None). Here, we assume that such - // types would have been simplified to a different representation earlier and - // simply return false. + // A single-element union, where the sole element was a singleton, would itself + // be a singleton type. However, unions with length < 2 should never appear in + // our model due to [`UnionBuilder::build`]. false } Type::Intersection(..) => {