Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better reporting of errors #47

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

ltratt
Copy link
Member

@ltratt ltratt commented Jun 3, 2024

This PR fixes/changes a number of error location reporting "things". One is a clear bug (ba7da28) but two others (9794e4e, 6542ea4) are "this makes finding what wrong easier" rather than "bug". Finally a1462a0 is a different aspect of "make finding what wrong easier".

I've used each of these while debugging some fairly hairy pattern matching failures.

When using the `..~` operator, it could eventually match after having
failed several times, and accidentally increment the apparent line the
pattern failed to match at. This didn't affect the matching algorithm,
but meant that a failure to match would report the wrong position in the
pattern. The new test line below incorrectly reported `(8, 6)` before
the fix in this commit.
When `...` fails to match it (sensibly) tells you that the error was on
the of the pattern *after* the `...`, but `..~` reported the pattern
line itself. This commit makes `..~` follow `...`s behaviour.
Previously when `...` failed, it told you how-far-it-got before
realising it had failed, rather than the more useful where-it-started.
This commit fixes that.
@vext01
Copy link
Member

vext01 commented Jun 3, 2024

Nice!

@vext01 vext01 added this pull request to the merge queue Jun 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 3, 2024
@ltratt
Copy link
Member Author

ltratt commented Jun 3, 2024

I'm an idiot. OK to squash?

Previously if name matching matched input, you had to guess what had
been matched: this change now prints it out in the error summary.
@vext01
Copy link
Member

vext01 commented Jun 3, 2024

OK

@ltratt ltratt force-pushed the better_reporting_of_errors branch from dbfd1da to 7b2591b Compare June 3, 2024 13:44
@ltratt
Copy link
Member Author

ltratt commented Jun 3, 2024

Squashed.

@vext01 vext01 added this pull request to the merge queue Jun 3, 2024
Merged via the queue into softdevteam:master with commit 71b4a00 Jun 3, 2024
2 checks passed
@ltratt ltratt deleted the better_reporting_of_errors branch August 30, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants