Skip to content

formatter: debug panic in placement::find_pos_only_slash_offset #5176

@davidszotten

Description

@davidszotten

while working on comments inside tuple unpacking between stars and name (following #5167 (comment) )

i was wondering if function arguments could have the same issue. in trying to test that i found my test case violates this debug assert

$ cat ../../scratch.py
def foo(
    a=2 ** 3 # trailing
):
    ...
$ cargo run --bin ruff_python_formatter -- --emit stdout ../../scratch.py
   [...]
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `RParen`,
 right: `Comma`', crates/ruff_python_formatter/src/comments/placement.rs:846:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

commit: be11cae

Metadata

Metadata

Assignees

No one assigned

    Labels

    formatterRelated to the formatter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions