Closed davesnx closed 8 months ago
~Previously we kept track of container_lnum
when we were parsing on the ppx and it was passed to the code-gen.~
Copying the comment from https://github.com/davesnx/styled-ppx/pull/456
After this PR the locations don't look exactly I would like it to, but they are close enough:
+ File "input.re", lines 10-11, characters 6-36:
+ 10 | ......|
+ 11 | text-decoration: $(cosas).
+ Error: This expression has type [> `underlin ]
+ but an expression was expected of type
+ [< `inherit_
+ | `initial
+ | `lineThrough
+ | `none
+ | `overline
+ | `underline
+ | `unset
+ | `var of string
+ | `varDefault of string * string ]
+ The second variant type does not allow tag(s) `underlin
+ [1]
The remaining work to make them perfect is to make sure css_lexer and css_parser respect whitespaces and use loc in menhir properly
Closing this issue since the bug has been fixed
Unsure when it happened, but between 0.52 and 0.54 the location of the generated code is broken in a few cases, the most annoying is when there's a type-miss match on interpolation:
The
line 1, characters 1-16
is wrong, we don't se the right line number and should point to the interpolation instead.