Skip to content

conditional_to_if idempotence failure with very short margin #1160

Description

@penelopeysm
s = "p ? (q; r) : s"

test_format(s, nothing; margin=4, conditional_to_if=true)
Formatting was not idempotent.

First pass:
if p
    (
    q;
    r
)
else
    s
end

Second pass:
if p
    (
        q;
        r
    )
else
    s
end

If the margin is large enough to fit (q; r) on one line, this isn't a problem. It's specifically an issue with the way (q; r) is nested.

Personally, I'm really not very inclined to fix this because conditional_to_if is known to cause idempotence failures anyway, plus the trigger is quite specific. If someone complains, I'll fix it, but otherwise, mehhh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Priority 3 — see contributing docs

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions