diff --git a/crates/ty_python_semantic/src/types/generics.rs b/crates/ty_python_semantic/src/types/generics.rs index fe3014e47f..90ab8ed824 100644 --- a/crates/ty_python_semantic/src/types/generics.rs +++ b/crates/ty_python_semantic/src/types/generics.rs @@ -1886,7 +1886,9 @@ impl<'db> SpecializationBuilder<'db> { let when = actual .when_constraint_set_assignable_to(self.db, formal, self.inferable) .limit_to_valid_specializations(self.db); - if when.is_never_satisfied(self.db) { + if when.is_never_satisfied(self.db) + && (formal.has_typevar(self.db) || actual.has_typevar(self.db)) + { return Err(SpecializationError::NoSolution { parameter: formal, argument: actual,