-
Notifications
You must be signed in to change notification settings - Fork 139
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
The verbose option for parsing should have 3 levels, like $VERBOSE #2082
Comments
A typical encoding of $VERBOSE (nil, false, true) values is (0, 1, 2), which also reflects the ruby
(the |
Yeah, makes sense |
One more very-related concern about this, that I forgot when filing this issue but remembered now: The reason is when caching the serialized output of a file, it would be best to reuse the serialized output if nothing changes but the TruffleRuby already uses some kind of in-process parse caching (which Truffle provides) and so how it deals with that is all warnings (so as if $VERBOSE was always true) are always saved into an array, and around the compiled AST there is an extra node (EmitWarningsNode)/instruction to emit warnings (or not) based on the $VERBOSE level when executing it. A flag per This means the 3 levels for the option might not be strictly needed, because |
@eregon From reading that I got that we could emit all warning modes into all parsing and then allow consumer of that to emit the proper subset of warnings are used depend on on If not this is definitely a requirement for precompilation since a precompiled file would not know what verbosity it will be loaded with. We 100% want this for JRuby but I would be surprised if everyone will not want the option. So I think we should remove data field and always emit all warnings with their verbosity level (0-2) and then let the runtime decide which ones they should warn with. |
Oh my that's definitely a consideration. In that case I think this ticket becomes that |
Yep that would work and be simpler. |
* Until ruby/prism#2082 is resolved.
* Until ruby/prism#2082 is resolved.
* Until ruby/prism#2082 is resolved.
I'll try to fix this. |
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
…E == false warning * Fixes ruby#2082
* Until ruby/prism#2082 is resolved.
* Until ruby/prism#2082 is resolved.
* Until ruby/prism#2082 is resolved.
There are 3 states for
$VERBOSE
(true, false, nil) and some parser warnings warn atfalse
while some only warn attrue
(and of course none warn atnil
):But the current API only has true/false, and nil means default and not a separate value (AFAIK):
https://ruby.github.io/prism/rb/Prism.html#method-c-parse
And in fact
pm_options_suppress_warnings_set
takes a boolean.Also the serialization has a reversed option called suppress warnings:
https://github.com/ruby/prism/blob/main/docs/serialization.md#apis
And that caused quite a bit of confusion (e.g. #2080 but not only), so a good occasion to change that to a 3-states verbose.
Originally posted by @eregon in #2080 (comment)
The text was updated successfully, but these errors were encountered: