mirror of
https://github.com/astral-sh/ruff.git
synced 2026-05-06 08:56:57 -04:00
[ty] Tighten up validation of subscripts and attributes in type expressions (#24329)
This commit is contained in:
@@ -1681,6 +1681,14 @@ pub fn comment_indentation_after(
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn is_dotted_name(expr: &ast::Expr) -> bool {
|
||||
match expr {
|
||||
ast::Expr::Name(_) => true,
|
||||
ast::Expr::Attribute(ast::ExprAttribute { value, .. }) => is_dotted_name(value),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::borrow::Cow;
|
||||
|
||||
Reference in New Issue
Block a user