unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

Unhelpful error message if doc backtick is unmatched #5353

Closed ceedubs closed 2 weeks ago

ceedubs commented 2 months ago

If you have an unclosed backtick in a doc literal, the parser will continue searching for its match until the end of the file. As far as I know, using single backticks in markdown only supports inline code, so ideally this could give an error message citing the relevant line and noting that a backtick wasn't matched.

Here is an example:

{{
``foo t`` does stuff with `t.
}}
foo : Text -> Text
foo t = t ++ t

What's the message you're seeing?

  Loading changes detected in ~/code/unison/base.u.

  I got confused here:

   1678 | 

  resetting state

The error message isn't very helpful, and it continues past the fold in my scratch file and reports the error on line 1678.

What would a better version look like?

  Unmatched backtick in doc literal.

      2 | ``foo t`` does stuff with `t.
                                    ^

Environment (please complete the following information):

aryairani commented 2 months ago

Likely dupe of https://github.com/unisonweb/unison/issues/5073 (in progress)

sellout commented 2 weeks ago

Yeah, duplicate of #5073.