gleam-lang/gleam

Emphasize mismatching part of complex type mismatches

Open

#4578 aperta il 9 mag 2025

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Rust (960 fork)batch import
discussionhelp wanted

Metriche repository

Star
 (21.417 star)
Metriche merge PR
 (Merge medio 10g 19h) (69 PR mergiate in 30 g)

Descrizione

When a type mismatch is complex, and some types are unbound (is this the correct term?), it can be hard to see where the error actually is. Here is a concrete example I actually wasted quite a bit of time on:

Expected type:

    drift.Step(List(String), Input, Output, Nil)

Found type:

    drift.Step(List(string), Input, a, b)

It could be made clearer by emphasizing where the type mismatch was exactly:

Expected type:

    drift.Step(List(String), Input, Output, Nil)
                    ^^^^^^

Found type:

    drift.Step(List(string), Input, a, b)
                    ^^^^^^

Guida contributor