-
Notifications
You must be signed in to change notification settings - Fork 440
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
Friendlier error message for invalid indices #221
Comments
I agree, but out of interest was the line/column accurate? |
Argh, I lost the original error and can't remember what caused it now. Will comment again if I run into it again. |
Aha, I got it again, and the location was correct but a little confusing because I was looking for an array index. The actual culprit was (equivalent to):
It presumably happens because the dot notation gets desugared into square brackets, which mean that we end up with |
It'd be good for it to remember the fact that this started off life as a ".foo" and print a different error message in that case. However what you originally proposed is simpler and probably good enough. |
People use these operators in tight loops, without even thinking about it, and it's previous implementation required multiple object lookups (std.), string comparisons (for types) and multiple jsonnet function calls. This change introduces builtin, efficient implementation. It results in ~3x speedup in strContains benchmark that Angus provided on Slack. Additional benefit is that equals/primitiveEquals distinction is now obsolete, which made things simpler for everyone.
For example, I got:
It would be easier to track down what was wrong if it told me what unexpected string it got
The text was updated successfully, but these errors were encountered: