Skip to content

Commit c36f3f5

Browse files
authored
[red-knot] Add KnownFunction variants for is_protocol, get_protocol_members and runtime_checkable (#17450)
1 parent fcd50a0 commit c36f3f5

File tree

1 file changed

+12
-0
lines changed
  • crates/red_knot_python_semantic/src

1 file changed

+12
-0
lines changed

crates/red_knot_python_semantic/src/types.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5896,6 +5896,12 @@ pub enum KnownFunction {
58965896
Cast,
58975897
/// `typing(_extensions).overload`
58985898
Overload,
5899+
/// `typing(_extensions).is_protocol`
5900+
IsProtocol,
5901+
/// `typing(_extensions).get_protocol_members`
5902+
GetProtocolMembers,
5903+
/// `typing(_extensions).runtime_checkable`
5904+
RuntimeCheckable,
58995905

59005906
/// `abc.abstractmethod`
59015907
#[strum(serialize = "abstractmethod")]
@@ -5957,6 +5963,9 @@ impl KnownFunction {
59575963
| Self::Overload
59585964
| Self::RevealType
59595965
| Self::Final
5966+
| Self::IsProtocol
5967+
| Self::GetProtocolMembers
5968+
| Self::RuntimeCheckable
59605969
| Self::NoTypeCheck => {
59615970
matches!(module, KnownModule::Typing | KnownModule::TypingExtensions)
59625971
}
@@ -7195,6 +7204,9 @@ pub(crate) mod tests {
71957204
| KnownFunction::RevealType
71967205
| KnownFunction::AssertType
71977206
| KnownFunction::AssertNever
7207+
| KnownFunction::IsProtocol
7208+
| KnownFunction::GetProtocolMembers
7209+
| KnownFunction::RuntimeCheckable
71987210
| KnownFunction::NoTypeCheck => KnownModule::TypingExtensions,
71997211

72007212
KnownFunction::IsSingleton

0 commit comments

Comments
 (0)