mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:18 +00:00
correct signature of assert_type
This commit is contained in:
parent
0babd8d9d4
commit
49661f294a
3 changed files with 20 additions and 19 deletions
|
@ -4192,20 +4192,26 @@ impl<'db> Type<'db> {
|
|||
.into()
|
||||
}
|
||||
|
||||
Some(KnownFunction::AssertType) => Binding::single(
|
||||
self,
|
||||
Signature::new(
|
||||
Parameters::new([
|
||||
Parameter::positional_only(Some(Name::new_static("value")))
|
||||
.with_annotated_type(Type::any()),
|
||||
Parameter::positional_only(Some(Name::new_static("type")))
|
||||
.type_form()
|
||||
.with_annotated_type(Type::any()),
|
||||
]),
|
||||
Some(Type::none(db)),
|
||||
),
|
||||
)
|
||||
.into(),
|
||||
Some(KnownFunction::AssertType) => {
|
||||
let val_ty =
|
||||
BoundTypeVarInstance::synthetic(db, "T", TypeVarVariance::Invariant);
|
||||
|
||||
Binding::single(
|
||||
self,
|
||||
Signature::new_generic(
|
||||
Some(GenericContext::from_typevar_instances(db, [val_ty])),
|
||||
Parameters::new([
|
||||
Parameter::positional_only(Some(Name::new_static("value")))
|
||||
.with_annotated_type(Type::TypeVar(val_ty)),
|
||||
Parameter::positional_only(Some(Name::new_static("type")))
|
||||
.type_form()
|
||||
.with_annotated_type(Type::any()),
|
||||
]),
|
||||
Some(Type::TypeVar(val_ty)),
|
||||
),
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
Some(KnownFunction::AssertNever) => {
|
||||
Binding::single(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue