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

[Bug][move-compiler] Tiny parser degradation with PR 14792 #15133

Open
brmataptos opened this issue Oct 31, 2024 · 0 comments
Open

[Bug][move-compiler] Tiny parser degradation with PR 14792 #15133

brmataptos opened this issue Oct 31, 2024 · 0 comments
Labels
bug Something isn't working compiler-errormessage compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@brmataptos
Copy link
Contributor

🐛 Bug

PR 14792 changes the way comma lists are parsed slightly, causing test case output third_party/move/move-compiler-2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp to get slightly worse. The diff is here:

   ┌─ tests/more-v1/parser/unexpected_token_after_ability_function_constraint.move:4:21
   │
 4 │     fun foo<T: copy & drop>() {}
-  │                     ^
-  │                     │
-  │                     Unexpected '&'
-  │                     Expected one of: '+', '>', or ','
+  │            -        ^ Expected '>'
+  │            │
+  │            To match this '<'

The problem is that subterm parsing ends and recovery is not attempted until at the list level, where either a comma or a > is expected.

This could be addressed by returning expected tokens along with the returned subterm, so that when we reach an impasse we could add those tokens to the list shown to the user. It might involve a widespread change to the parser (returning expected next tokens along with a successfully parsed item), but probably would greatly improve user experience.

@brmataptos brmataptos added bug Something isn't working compiler-v2 compiler-errormessage stale-exempt Prevents issues from being automatically marked and closed as stale labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler-errormessage compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: For Grabs
Development

No branches or pull requests

1 participant