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

Allow the parser to add contextual help text to errors; Add contextual help text for parenthesized for loops #1828

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

sezna
Copy link
Contributor

@sezna sezna commented Aug 9, 2024

Given the problems users have faced with non-parenthesized for loop iterators (like this one), we wanted to provide some help text for the user in this situation.

Instead of just patching in a fix for precisely this situation, I wanted to use miette's great functionality for composable errors. So, with this change, can now compose any parse error with help text.

I also manually implemented Debug for Error to omit the help text if it isn't present. This is primarily so this PR doesn't add None to every single parser expect test which tests errors. (Happy to revert this and update the tests if desired, but I really don't like spraying the diff with 1k lines of expect-test changes that just say None)

@sezna sezna marked this pull request as ready for review August 9, 2024 21:29
Copy link

github-actions bot commented Aug 9, 2024

Benchmark for edf0a55

Click to view benchmark
Test Base PR %
Array append evaluation 334.4±1.70µs 335.0±2.21µs +0.18%
Array literal evaluation 186.4±2.27µs 169.3±4.28µs -9.17%
Array update evaluation 414.8±2.68µs 415.0±2.10µs +0.05%
Core + Standard library compilation 21.3±0.69ms 23.2±0.77ms +8.92%
Deutsch-Jozsa evaluation 5.0±0.08ms 4.9±0.06ms -2.00%
Large file parity evaluation 34.5±0.17ms 34.6±0.45ms +0.29%
Large input file compilation 12.5±0.12ms 13.3±0.33ms +6.40%
Large input file compilation (interpreter) 48.3±0.61ms 54.7±1.36ms +13.25%
Large nested iteration 33.0±0.90ms 33.0±0.21ms 0.00%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1576.1±48.60µs 1594.2±92.51µs +1.15%
Perform Runtime Capabilities Analysis (RCA) on large file sample 7.7±0.05ms 8.0±0.15ms +3.90%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1444.5±55.51µs 1477.7±168.18µs +2.30%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 27.8±1.19ms 28.1±0.31ms +1.08%
Teleport evaluation 92.8±3.25µs 92.7±6.09µs -0.11%

@sezna sezna requested a review from swernli August 9, 2024 22:30
Copy link

github-actions bot commented Aug 9, 2024

Benchmark for 6215868

Click to view benchmark
Test Base PR %
Array append evaluation 337.9±5.16µs 333.9±2.85µs -1.18%
Array literal evaluation 168.3±0.84µs 168.7±3.98µs +0.24%
Array update evaluation 423.9±20.77µs 413.7±1.88µs -2.41%
Core + Standard library compilation 21.1±0.91ms 21.5±0.53ms +1.90%
Deutsch-Jozsa evaluation 5.0±0.18ms 4.8±0.04ms -4.00%
Large file parity evaluation 34.4±0.19ms 34.0±0.21ms -1.16%
Large input file compilation 12.6±0.24ms 12.8±0.43ms +1.59%
Large input file compilation (interpreter) 48.4±0.72ms 49.7±1.81ms +2.69%
Large nested iteration 33.0±0.20ms 33.0±0.25ms 0.00%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1560.7±35.75µs 1558.0±40.21µs -0.17%
Perform Runtime Capabilities Analysis (RCA) on large file sample 7.8±0.13ms 7.8±0.27ms 0.00%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1418.1±29.84µs 1421.3±31.75µs +0.23%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 27.5±0.22ms 27.6±0.32ms +0.36%
Teleport evaluation 92.0±3.11µs 92.5±7.50µs +0.54%

Copy link

github-actions bot commented Aug 9, 2024

Benchmark for ada005d

Click to view benchmark
Test Base PR %
Array append evaluation 338.1±3.97µs 337.4±2.19µs -0.21%
Array literal evaluation 186.0±2.76µs 168.7±0.97µs -9.30%
Array update evaluation 416.5±1.99µs 419.0±4.20µs +0.60%
Core + Standard library compilation 21.2±0.29ms 22.2±0.54ms +4.72%
Deutsch-Jozsa evaluation 5.0±0.07ms 4.9±0.06ms -2.00%
Large file parity evaluation 34.3±0.14ms 34.1±0.52ms -0.58%
Large input file compilation 12.7±0.18ms 12.9±0.32ms +1.57%
Large input file compilation (interpreter) 49.1±0.81ms 49.1±0.75ms 0.00%
Large nested iteration 33.0±0.16ms 33.1±0.55ms +0.30%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1555.4±28.66µs 1555.9±32.65µs +0.03%
Perform Runtime Capabilities Analysis (RCA) on large file sample 7.8±0.04ms 7.8±0.14ms 0.00%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1416.1±31.07µs 1421.2±39.46µs +0.36%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 27.6±0.40ms 27.9±0.21ms +1.09%
Teleport evaluation 92.1±3.55µs 92.0±3.36µs -0.11%

@sezna sezna added this pull request to the merge queue Aug 12, 2024
Merged via the queue into main with commit 7df2d20 Aug 12, 2024
19 checks passed
@sezna sezna deleted the alex/error-help-text branch August 12, 2024 22:31
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.

3 participants