Isolate some bugs in the autofixer

This commit is contained in:
Charlie Marsh 2023-02-11 18:26:12 -05:00
parent 86d0749ed7
commit ca3b4224d0
3 changed files with 2508 additions and 0 deletions

2486
bar.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -393,6 +393,7 @@ pub fn lint_fix<'a>(
// longer parseable on a subsequent pass, then we've introduced a
// syntax error. Return the original code.
if parseable && result.error.is_some() {
println!("{}", transformed);
#[allow(clippy::print_stderr)]
{
eprintln!(

21
foo.py Normal file
View File

@ -0,0 +1,21 @@
def f():
with Nested(m) as (foo):
pass
def f():
# Issue #23192: Test that a lambda returning a generator behaves
# like the equivalent function
f = lambda: (yield 1)
def g(): return (yield 1)
# test 'yield from'
f2 = lambda: (yield from g())
def g2(): return (yield from g())
f3 = lambda: (yield from f())
def f():
# Remove `toplevel`.
toplevel = tt = lexer.get_token()
if not tt:
break