Upgrade RustPython (#4900)

This commit is contained in:
Micha Reiser 2023-06-08 07:53:14 +02:00 committed by GitHub
parent 4b78141f6b
commit 39a1f3980f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 416 additions and 320 deletions

View file

@ -745,9 +745,13 @@ fn find_pos_only_slash_offset(
),
locator.contents(),
)
.map(|(offset, c)| {
debug_assert_eq!(c, '/');
offset
.and_then(|(offset, c)| {
if c == '/' {
Some(offset)
} else {
debug_assert_eq!(c, ')');
None
}
})
},
)

View file

@ -5,8 +5,8 @@ expression: comments.debug(test_case.source_code)
{
Node {
kind: Arguments,
range: 10..94,
source: `a=10,/, # trailing position...t comment.⏎`,
range: 9..96,
source: `(a=10,/, # trailing positio...t comment.⏎`,
}: {
"leading": [],
"dangling": [

View file

@ -5,8 +5,8 @@ expression: comments.debug(test_case.source_code)
{
Node {
kind: Arguments,
range: 15..177,
source: `a=10 # trailing positional comment⏎`,
range: 9..179,
source: `(⏎`,
}: {
"leading": [],
"dangling": [

View file

@ -3,25 +3,10 @@ source: crates/ruff_python_formatter/src/comments/mod.rs
expression: comments.debug(test_case.source_code)
---
{
Node {
kind: Arg,
range: 15..16,
source: `a`,
}: {
"leading": [],
"dangling": [],
"trailing": [
SourceComment {
text: "# trailing positional comment",
position: EndOfLine,
formatted: false,
},
],
},
Node {
kind: Arguments,
range: 15..168,
source: `a, # trailing positional comment⏎`,
range: 9..170,
source: `(⏎`,
}: {
"leading": [],
"dangling": [
@ -38,6 +23,21 @@ expression: comments.debug(test_case.source_code)
],
"trailing": [],
},
Node {
kind: Arg,
range: 15..16,
source: `a`,
}: {
"leading": [],
"dangling": [],
"trailing": [
SourceComment {
text: "# trailing positional comment",
position: EndOfLine,
formatted: false,
},
],
},
Node {
kind: Arg,
range: 166..167,

View file

@ -3,6 +3,26 @@ source: crates/ruff_python_formatter/src/comments/mod.rs
expression: comments.debug(test_case.source_code)
---
{
Node {
kind: Arguments,
range: 9..166,
source: `(⏎`,
}: {
"leading": [],
"dangling": [
SourceComment {
text: "# Positional arguments only after here",
position: OwnLine,
formatted: false,
},
SourceComment {
text: "# trailing positional argument comment.",
position: EndOfLine,
formatted: false,
},
],
"trailing": [],
},
Node {
kind: Arg,
range: 15..16,
@ -16,42 +36,11 @@ expression: comments.debug(test_case.source_code)
position: EndOfLine,
formatted: false,
},
],
},
Node {
kind: Arguments,
range: 15..97,
source: `a, # trailing positional comment⏎`,
}: {
"leading": [],
"dangling": [
SourceComment {
text: "# Positional arguments only after here",
position: OwnLine,
formatted: false,
},
],
"trailing": [
SourceComment {
text: "# trailing positional argument comment.",
position: EndOfLine,
formatted: false,
},
],
},
Node {
kind: StmtPass,
range: 168..172,
source: `pass`,
}: {
"leading": [
SourceComment {
text: "# Trailing on new line",
position: OwnLine,
formatted: false,
},
],
"dangling": [],
"trailing": [],
},
}

View file

@ -3,25 +3,10 @@ source: crates/ruff_python_formatter/src/comments/mod.rs
expression: comments.debug(test_case.source_code)
---
{
Node {
kind: Arg,
range: 15..16,
source: `a`,
}: {
"leading": [],
"dangling": [],
"trailing": [
SourceComment {
text: "# trailing positional comment",
position: EndOfLine,
formatted: false,
},
],
},
Node {
kind: Arguments,
range: 15..168,
source: `a # trailing positional comment⏎`,
range: 9..170,
source: `(⏎`,
}: {
"leading": [],
"dangling": [
@ -38,6 +23,21 @@ expression: comments.debug(test_case.source_code)
],
"trailing": [],
},
Node {
kind: Arg,
range: 15..16,
source: `a`,
}: {
"leading": [],
"dangling": [],
"trailing": [
SourceComment {
text: "# trailing positional comment",
position: EndOfLine,
formatted: false,
},
],
},
Node {
kind: Arg,
range: 166..167,