difftastic icon indicating copy to clipboard operation
difftastic copied to clipboard

Bad sliders when adding nested expression in Rust

Open Wilfred opened this issue 3 years ago • 6 comments

See 97b9a13d15f413398d0aa75ae0241658d4d9d1f5, options.rs 2/5. This might be another issue with skip unchanged logic shrinking too much.

Screenshot from 2022-04-01 22-29-27

Wilfred avatar Apr 02 '22 05:04 Wilfred

Minimal repro (requires DFT_DBG_KEEP_UNCHANGED=t)

fn app() {
    x
        .arg(
            color
        )
}

After:

fn app() {
    x
        .arg(
            display
        )
        .arg(
            color
        )
}

Wilfred avatar Apr 03 '22 05:04 Wilfred

After skipping unchanged, we're just comparing x with x.arg(display), which does the right thing.

Wilfred avatar Apr 03 '22 06:04 Wilfred

Smaller repro:

Before:

x.arg(color)

After

x.arg().arg(color)

Wilfred avatar Apr 03 '22 22:04 Wilfred

Clojure equivalent

; old
((.arg x) color)

; new
((.arg ((.arg x)) color)

Wilfred avatar Apr 03 '22 22:04 Wilfred

Interestingly, penalising code for preferring contiguous items seems to improve results both in this file, and in typing_before.rs and load_before.rs.

Wilfred avatar Apr 03 '22 23:04 Wilfred

typing_before.ml is improved, but load_before.js is worse. It's now preferring , over the string literals, which isn't ideal. Score should probably reflect atom length.

Wilfred avatar Apr 03 '22 23:04 Wilfred