Skip to content

Conversation

munificent
Copy link
Member

It would output the as clause after the if clauses, which isn't syntactically valid. Apparently no one has ever had a conditional import with as prefix because this was a bug in both the old and new formatters and has been a bug in the old formatter forever.

Fix #1544.

It would output the `as` clause after the `if` clauses, which isn't
syntactically valid. Apparently no one has ever had a conditional import
with as prefix because this was a bug in both the old and new
formatters and has been a bug in the old formatter forever.

Fix #1544.
@munificent munificent merged commit 953ecbc into main Aug 29, 2024
7 checks passed
@munificent munificent deleted the import-as-and-if branch August 29, 2024 00:48
munificent added a commit that referenced this pull request Sep 4, 2024
PR #1550 fixed the bug where if you had both clauses, it would output
them in the *wrong* order. But it turns out that the parser today allows
them in *either* order even though the language spec doesn't.

Since I've seen a handful of cases like this in the wild, instead of
just failing to format, simply preserve the clause order that the user
wrote.
munificent added a commit that referenced this pull request Sep 4, 2024
PR #1550 fixed the bug where if you had both clauses, it would output
them in the *wrong* order. But it turns out that the parser today allows
them in *either* order even though the language spec doesn't.

Since I've seen a handful of cases like this in the wild, instead of
just failing to format, simply preserve the clause order that the user
wrote.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import truncation & generic error in formatting file
2 participants