rustpython-ruff_python_parser 0.15.8

Unofficial fork for RustPython
Documentation
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/ann_assign_stmt_invalid_annotation.py
---
## AST

```
Module(
    ModModule {
        node_index: NodeIndex(None),
        range: 0..63,
        body: [
            AnnAssign(
                StmtAnnAssign {
                    node_index: NodeIndex(None),
                    range: 0..11,
                    target: Name(
                        ExprName {
                            node_index: NodeIndex(None),
                            range: 0..1,
                            id: Name("x"),
                            ctx: Store,
                        },
                    ),
                    annotation: Starred(
                        ExprStarred {
                            node_index: NodeIndex(None),
                            range: 3..7,
                            value: Name(
                                ExprName {
                                    node_index: NodeIndex(None),
                                    range: 4..7,
                                    id: Name("int"),
                                    ctx: Load,
                                },
                            ),
                            ctx: Load,
                        },
                    ),
                    value: Some(
                        NumberLiteral(
                            ExprNumberLiteral {
                                node_index: NodeIndex(None),
                                range: 10..11,
                                value: Int(
                                    1,
                                ),
                            },
                        ),
                    ),
                    simple: true,
                },
            ),
            AnnAssign(
                StmtAnnAssign {
                    node_index: NodeIndex(None),
                    range: 12..26,
                    target: Name(
                        ExprName {
                            node_index: NodeIndex(None),
                            range: 12..13,
                            id: Name("x"),
                            ctx: Store,
                        },
                    ),
                    annotation: Yield(
                        ExprYield {
                            node_index: NodeIndex(None),
                            range: 15..22,
                            value: Some(
                                Name(
                                    ExprName {
                                        node_index: NodeIndex(None),
                                        range: 21..22,
                                        id: Name("a"),
                                        ctx: Load,
                                    },
                                ),
                            ),
                        },
                    ),
                    value: Some(
                        NumberLiteral(
                            ExprNumberLiteral {
                                node_index: NodeIndex(None),
                                range: 25..26,
                                value: Int(
                                    1,
                                ),
                            },
                        ),
                    ),
                    simple: true,
                },
            ),
            AnnAssign(
                StmtAnnAssign {
                    node_index: NodeIndex(None),
                    range: 27..46,
                    target: Name(
                        ExprName {
                            node_index: NodeIndex(None),
                            range: 27..28,
                            id: Name("x"),
                            ctx: Store,
                        },
                    ),
                    annotation: YieldFrom(
                        ExprYieldFrom {
                            node_index: NodeIndex(None),
                            range: 30..42,
                            value: Name(
                                ExprName {
                                    node_index: NodeIndex(None),
                                    range: 41..42,
                                    id: Name("b"),
                                    ctx: Load,
                                },
                            ),
                        },
                    ),
                    value: Some(
                        NumberLiteral(
                            ExprNumberLiteral {
                                node_index: NodeIndex(None),
                                range: 45..46,
                                value: Int(
                                    1,
                                ),
                            },
                        ),
                    ),
                    simple: true,
                },
            ),
            AnnAssign(
                StmtAnnAssign {
                    node_index: NodeIndex(None),
                    range: 47..51,
                    target: Name(
                        ExprName {
                            node_index: NodeIndex(None),
                            range: 47..48,
                            id: Name("x"),
                            ctx: Store,
                        },
                    ),
                    annotation: Name(
                        ExprName {
                            node_index: NodeIndex(None),
                            range: 50..51,
                            id: Name("y"),
                            ctx: Load,
                        },
                    ),
                    value: None,
                    simple: true,
                },
            ),
            Assign(
                StmtAssign {
                    node_index: NodeIndex(None),
                    range: 55..62,
                    targets: [
                        Name(
                            ExprName {
                                node_index: NodeIndex(None),
                                range: 55..58,
                                id: Name("int"),
                                ctx: Store,
                            },
                        ),
                    ],
                    value: NumberLiteral(
                        ExprNumberLiteral {
                            node_index: NodeIndex(None),
                            range: 61..62,
                            value: Int(
                                1,
                            ),
                        },
                    ),
                },
            ),
        ],
    },
)
```
## Errors

  |
1 | x: *int = 1
  |    ^^^^ Syntax Error: Starred expression cannot be used here
2 | x: yield a = 1
3 | x: yield from b = 1
  |


  |
1 | x: *int = 1
2 | x: yield a = 1
  |    ^^^^^^^ Syntax Error: Yield expression cannot be used here
3 | x: yield from b = 1
4 | x: y := int = 1
  |


  |
1 | x: *int = 1
2 | x: yield a = 1
3 | x: yield from b = 1
  |    ^^^^^^^^^^^^ Syntax Error: Yield expression cannot be used here
4 | x: y := int = 1
  |


  |
2 | x: yield a = 1
3 | x: yield from b = 1
4 | x: y := int = 1
  |      ^^ Syntax Error: Expected a statement
  |


## Semantic Syntax Errors

  |
1 | x: *int = 1
2 | x: yield a = 1
  |    ^^^^^^^ Syntax Error: yield expression cannot be used within a type annotation
3 | x: yield from b = 1
4 | x: y := int = 1
  |


  |
1 | x: *int = 1
2 | x: yield a = 1
3 | x: yield from b = 1
  |    ^^^^^^^^^^^^ Syntax Error: yield expression cannot be used within a type annotation
4 | x: y := int = 1
  |