Add support for PEP 696 syntax (#11120)

This commit is contained in:
Jelle Zijlstra 2024-04-26 00:47:29 -07:00 committed by GitHub
parent 45725d3275
commit cd3e319538
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 4338 additions and 669 deletions

View file

@ -4317,6 +4317,7 @@ impl AstNode for ast::TypeParamTypeVar {
{
let ast::TypeParamTypeVar {
bound,
default,
name: _,
range: _,
} = self;
@ -4324,6 +4325,9 @@ impl AstNode for ast::TypeParamTypeVar {
if let Some(expr) = bound {
visitor.visit_expr(expr);
}
if let Some(expr) = default {
visitor.visit_expr(expr);
}
}
}
impl AstNode for ast::TypeParamTypeVarTuple {
@ -4355,11 +4359,18 @@ impl AstNode for ast::TypeParamTypeVarTuple {
}
#[inline]
fn visit_preorder<'a, V>(&'a self, _visitor: &mut V)
fn visit_preorder<'a, V>(&'a self, visitor: &mut V)
where
V: PreorderVisitor<'a> + ?Sized,
{
let ast::TypeParamTypeVarTuple { range: _, name: _ } = self;
let ast::TypeParamTypeVarTuple {
range: _,
name: _,
default,
} = self;
if let Some(expr) = default {
visitor.visit_expr(expr);
}
}
}
impl AstNode for ast::TypeParamParamSpec {
@ -4391,11 +4402,18 @@ impl AstNode for ast::TypeParamParamSpec {
}
#[inline]
fn visit_preorder<'a, V>(&'a self, _visitor: &mut V)
fn visit_preorder<'a, V>(&'a self, visitor: &mut V)
where
V: PreorderVisitor<'a> + ?Sized,
{
let ast::TypeParamParamSpec { range: _, name: _ } = self;
let ast::TypeParamParamSpec {
range: _,
name: _,
default,
} = self;
if let Some(expr) = default {
visitor.visit_expr(expr);
}
}
}
impl AstNode for ast::FString {