-
-
Notifications
You must be signed in to change notification settings - Fork 163
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 stringify list error #1764
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7bae33f
feat: better error message when trying to stringify a list
Melkor333 de4b66b
feat: better error for instead of @var
Melkor333 e88077a
feat: eliminate duplicate value_e.List stringify error
Melkor333 681c95c
another err message iteration
Melkor333 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo -- should be %s and not %g
I would say
"Maybe use @ to splice, instead of $"
The problem is that this error can actually appear in many places
We have noticed in the past that overly specific error messages can become misleading -- i.e. trying to be helpful doesn't always work:
https://oilshell.zulipchat.com/#narrow/stream/384942-language-design/topic/Problem.20with.20our.20static.20checks
It would also help to add another function to
test/ysh-runtime-errors.sh
, with all the examples that are intended to be changed by this commitThen we can run it and see how they look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a possibility to check the AST if we're at a
$
?The "dream" scenario IMO would be something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible in theory ... we have all the info necessary
But I don't think we have any examples of it. We would have to enumerate all the cases and make sure that the error makes sense.
I think this actually DOES exist in
test/ysh-runtime-errors.sh
, but I suppose it's not organized well enough to actually find them! I guess we could grep the output and find them.Whenever I write error messages, I put examples in that file, and eyeball them to see if they make sense.
As mentioned it's easy to construct an error for a specific situations, and then find it doesn't apply to other situations that hit the same code path
I think it's OK to say "Maybe" or "Hint" in those cases