Skip to content

Commit 87becf9

Browse files
committed
Correct annotation for StmtAnnAssign
1 parent c157850 commit 87becf9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

crates/ruff_python_ast/ast.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
# * `Expr*` - A vector of Expr.
5353
# * `&Expr*` - A boxed slice of Expr.
5454
# These properties cannot be nested, for example we cannot create a vector of option types.
55+
# * is_annotation - If this field is a type annotation.
5556
#
5657
# source_order:
5758
# Defines in what order the fields appear in source
@@ -137,7 +138,7 @@ fields = [
137138
doc = "See also [AnnAssign](https://docs.python.org/3/library/ast.html#ast.AnnAssign)"
138139
fields = [
139140
{ name = "target", type = "Expr" },
140-
{ name = "annotation", type = "Expr" },
141+
{ name = "annotation", type = "Expr", is_annotation = true },
141142
{ name = "value", type = "Expr?" },
142143
{ name = "simple", type = "bool" },
143144
]
@@ -443,7 +444,7 @@ custom_source_order = true
443444
doc = """An AST node that represents either a single-part bytestring literal
444445
or an implicitly concatenated bytestring literal."""
445446
fields = [{ name = "value", type = "BytesLiteralValue" }]
446-
# Because StringLiteralValue type is an iterator and it's not clear from the type
447+
# Because BytesLiteralValue type is an iterator and it's not clear from the type
447448
custom_source_order = true
448449

449450
[Expr.nodes.ExprNumberLiteral]

crates/ruff_python_ast/src/generated.rs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)