Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo committed Feb 5, 2025
1 parent 3566dae commit 32684c9
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,15 @@ fn generic_arguments_to_type_vars<'a>(
/// * It must not be unpacked
/// * It must not have any restrictions
fn type_var_is_valid(type_var: &TypeVar, unpacked: bool) -> bool {
match (&type_var.kind, unpacked, &type_var.restriction) {
(TypeParamKind::TypeVarTuple, false, _) => false,
(TypeParamKind::TypeVar, true, _) => false,
(TypeParamKind::ParamSpec, true, _) => false,
let is_type_var_tuple = matches!(&type_var.kind, TypeParamKind::TypeVarTuple);

(TypeParamKind::TypeVarTuple, _, Some(_)) => false,
(TypeParamKind::ParamSpec, _, Some(_)) => false,
if is_type_var_tuple && !unpacked || !is_type_var_tuple && unpacked {
return false;
}

_ => true,
if !matches!(&type_var.kind, TypeParamKind::TypeVar) && type_var.restriction.is_some() {
return false;
}

true
}

0 comments on commit 32684c9

Please sign in to comment.