johnyob / grace

A fancy diagnostics library that allows your compilers to exit with grace
MIT License
71 stars 2 forks source link

🐛 Bug: Inline multi-line `Top` marker contains underlines #2

Closed johnyob closed 5 months ago

johnyob commented 10 months ago

Context

Operating System: macOS

When printing a diagnostic containing a 'inline multi-line Top marker', the renderer incorrectly prints underlines until the start of the source line.

Current behaviour

error: `match` cases have incompatible types
    ┌─ fizz.ml:7:13
  2 │    let fizz n = 
  3 │ ╭──  match n mod 5, n mod 3 with
  4 │ │    | 0, 0 -> `Fizz_buzz
    │ │              ---------- this is found to be of type `[> `Fizz_buzz]`
  5 │ │    | 0, _ -> `Fizz
    │ │              ----- this is found to be of type `[> `Fizz]`
  6 │ │    | _, 0 -> `Buzz
    │ │              ----- this is found to be of type `[> `Buzz]`
  7 │ │    | _, _ -> n
    │ │              ^ expected `[> `Buzz | `Fizz | `Fizz_buzz]`, found `int`
    │ ╰──────────────' `match` cases have incompatible types
  8 │    ;;

Expected behaviour

error: `match` cases have incompatible types
    ┌─ fizz.ml:7:13
  2 │    let fizz n = 
  3 │ ╭    match n mod 5, n mod 3 with
  4 │ │    | 0, 0 -> `Fizz_buzz
    │ │              ---------- this is found to be of type `[> `Fizz_buzz]`
  5 │ │    | 0, _ -> `Fizz
    │ │              ----- this is found to be of type `[> `Fizz]`
  6 │ │    | _, 0 -> `Buzz
    │ │              ----- this is found to be of type `[> `Buzz]`
  7 │ │    | _, _ -> n
    │ │              ^ expected `[> `Buzz | `Fizz | `Fizz_buzz]`, found `int`
    │ ╰──────────────' `match` cases have incompatible types
  8 │    ;;