mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:47:41 +00:00
Enable auto-return-type involving Optional
and Union
annotations (#8885)
## Summary Previously, this was only supported for Python 3.10 and later, since we always use the PEP 604-style unions.
This commit is contained in:
parent
ec7456bac0
commit
6435e4e4aa
10 changed files with 526 additions and 69 deletions
|
@ -399,7 +399,7 @@ IpyHelpEndEscapeCommandStatement: ast::Stmt = {
|
|||
_ => {
|
||||
return Err(LexicalError {
|
||||
error: LexicalErrorType::OtherError("only Name, Subscript and Attribute expressions are allowed in help end escape command".to_string()),
|
||||
location: expr.range().start(),
|
||||
location: expr.start(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1642,12 +1642,12 @@ FStringReplacementField: ast::Expr = {
|
|||
} else {
|
||||
format_spec.as_ref().map_or_else(
|
||||
|| end_location - "}".text_len(),
|
||||
|spec| spec.range().start() - ":".text_len(),
|
||||
|spec| spec.start() - ":".text_len(),
|
||||
)
|
||||
};
|
||||
ast::DebugText {
|
||||
leading: source_code[TextRange::new(start_offset, value.range().start())].to_string(),
|
||||
trailing: source_code[TextRange::new(value.range().end(), end_offset)].to_string(),
|
||||
leading: source_code[TextRange::new(start_offset, value.start())].to_string(),
|
||||
trailing: source_code[TextRange::new(value.end(), end_offset)].to_string(),
|
||||
}
|
||||
});
|
||||
Ok(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue