---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/function_def_invalid_return_expr.py
snapshot_kind: text
---
## AST

```
Module(
    ModModule {
        range: 0..74,
        body: [
            FunctionDef(
                StmtFunctionDef {
                    range: 0..22,
                    is_async: false,
                    decorator_list: [],
                    name: Identifier {
                        id: Name("foo"),
                        range: 4..7,
                    },
                    type_params: None,
                    parameters: Parameters {
                        range: 7..9,
                        posonlyargs: [],
                        args: [],
                        vararg: None,
                        kwonlyargs: [],
                        kwarg: None,
                    },
                    returns: Some(
                        Starred(
                            ExprStarred {
                                range: 13..17,
                                value: Name(
                                    ExprName {
                                        range: 14..17,
                                        id: Name("int"),
                                        ctx: Load,
                                    },
                                ),
                                ctx: Load,
                            },
                        ),
                    ),
                    body: [
                        Expr(
                            StmtExpr {
                                range: 19..22,
                                value: EllipsisLiteral(
                                    ExprEllipsisLiteral {
                                        range: 19..22,
                                    },
                                ),
                            },
                        ),
                    ],
                },
            ),
            FunctionDef(
                StmtFunctionDef {
                    range: 23..47,
                    is_async: false,
                    decorator_list: [],
                    name: Identifier {
                        id: Name("foo"),
                        range: 27..30,
                    },
                    type_params: None,
                    parameters: Parameters {
                        range: 30..32,
                        posonlyargs: [],
                        args: [],
                        vararg: None,
                        kwonlyargs: [],
                        kwarg: None,
                    },
                    returns: Some(
                        Starred(
                            ExprStarred {
                                range: 37..41,
                                value: Name(
                                    ExprName {
                                        range: 38..41,
                                        id: Name("int"),
                                        ctx: Load,
                                    },
                                ),
                                ctx: Load,
                            },
                        ),
                    ),
                    body: [
                        Expr(
                            StmtExpr {
                                range: 44..47,
                                value: EllipsisLiteral(
                                    ExprEllipsisLiteral {
                                        range: 44..47,
                                    },
                                ),
                            },
                        ),
                    ],
                },
            ),
            FunctionDef(
                StmtFunctionDef {
                    range: 48..73,
                    is_async: false,
                    decorator_list: [],
                    name: Identifier {
                        id: Name("foo"),
                        range: 52..55,
                    },
                    type_params: None,
                    parameters: Parameters {
                        range: 55..57,
                        posonlyargs: [],
                        args: [],
                        vararg: None,
                        kwonlyargs: [],
                        kwarg: None,
                    },
                    returns: Some(
                        Yield(
                            ExprYield {
                                range: 61..68,
                                value: Some(
                                    Name(
                                        ExprName {
                                            range: 67..68,
                                            id: Name("x"),
                                            ctx: Load,
                                        },
                                    ),
                                ),
                            },
                        ),
                    ),
                    body: [
                        Expr(
                            StmtExpr {
                                range: 70..73,
                                value: EllipsisLiteral(
                                    ExprEllipsisLiteral {
                                        range: 70..73,
                                    },
                                ),
                            },
                        ),
                    ],
                },
            ),
        ],
    },
)
```
## Errors

  |
1 | def foo() -> *int: ...
  |              ^^^^ Syntax Error: Starred expression cannot be used here
2 | def foo() -> (*int): ...
3 | def foo() -> yield x: ...
  |


  |
1 | def foo() -> *int: ...
2 | def foo() -> (*int): ...
  |               ^^^^ Syntax Error: Starred expression cannot be used here
3 | def foo() -> yield x: ...
  |


  |
1 | def foo() -> *int: ...
2 | def foo() -> (*int): ...
3 | def foo() -> yield x: ...
  |              ^^^^^^^ Syntax Error: Yield expression cannot be used here
  |
