Open Zac-HD opened 1 year ago
I completely agree the parser error messages are often downright misleading as opposed to helpful. It would be great to improve them, but currently the parser generator library we use make it difficult to emit high-quality error messages. See https://github.com/kevinmehall/rust-peg/discussions/276 and https://github.com/kevinmehall/rust-peg/pull/289 for improving that situation.
Passing this on from https://github.com/HypothesisWorks/hypothesis/issues/3759:
The error message we get from
libcst
points to1:8
, i.e. the close-paren of the function definition, but the exception metadata instead points to the end of the function body (fordef f(*): ...
it points to the start of the def). Additionally, we seeexpected one of ,, NAME
, which suggests that the message is constructed from three alternatives of which two have an empty string representation.I've included the error raised by Python 3.10 for comparison; it points directly to the
*
and has a presumably-hand-written message explaining what's going on. Unclear how much of that is worth adopting or copying over, but testing that the location of syntax errors is compatible might be worthwhile?