-
Notifications
You must be signed in to change notification settings - Fork 1.7k
The VM should not print CFE warnings when it is running code #34137
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
Comments
Ping. I noticed a new warning for using |
When Dart VM runs from the source(rather than from the snapshot) it does compile the source first and the warnings you see I believe are coming from the compiler. |
Yes that matches my experience and the behavior when running from source is what I think we need to change - we should suppress the compiler output in that case. Neither running from source, nor creating an app-jit snapshot with training data should output anything on |
I am not sure I understand this. Couldn't that be the only opportunity for us to give user feedback about warnings in their dart program? |
Yes, if they never compile to a script snapshot or to kernel they might never see the warning from the CFE. In that case we'll rely on them running the analyzer to see it. AFAIK we're treating new CFE warnings as non-breaking, which means we'll suddenly start changing the output of Dart programs when run from source and upgrading SDKs. |
That sounds pretty fundamental. I don't understand why we would make the case of running dart from command line (
I would focus on this as there are a lot of assumptions here: 1) are we treating new CFE warnings as breaking/non-breaking? 2) Why running dart embedder from source and getting new warnings at that point is different from compiling that source explicitly and getting same new warnings there? 3) Are new warnings produced by analyzer treated differently than warnings produced by dart command line embedder? (meaning are analyzer's warnings similarly "breaking/non-breaking"?) Answers to the questions above seem to be prerequisites and outside of scope for this blanket request for dart command line embedder to silence all CFE warnings when running from source. |
This is not a CFE warning, it's a Dart language error. It's mandated by https://github.com/dart-lang/sdk/blob/master/docs/language/informal/generalized-void.md, and it's definitely a breaking change. The VM already prints warnings and errors on Hiding errors when running code seems like a usability problem. Some errors are (will be) fatal and there's no way to run the code at all. In those cases at least, we need to give the user some indication. |
I've seen them show up without any note at all the changelog - let alone a breaking change notification. In some conversations with @leafpetersen it was my understanding that we'd treat new errors as breaking (if they don't already exist in the analyzer as errors), and new warnings as non-breaking.
When executing code
AFAIK new warnings in either are considered non breaking externally - the code still runs and maintains the same semantics. They are breaking internally but we have tolerance for adding new static checking without a breaking version bump in the SDK because we control the code and can migrate it.
I have tools written in Dart where
It wasn't my intention to focus on any particular warning or error. Another case where this came up had to do with mandating new
I can't redirect it if
Yes, that's why I've specifically focused this issue on warnings. If we can't run the code - and by definition we can't if there are errors - then printing to |
Thanks for the details.
I understand what you mean, but I don't think that this is accurate. "When executing code" includes compilation and that might the only channel for the compiler to provide diagnostic to the user( see my
Can you make your tool more robust in a sense of ignoring stderr(if that is what you desire) until your code actually starts executing? |
I think my point is that these particular diagnostics (warnings that don't impact runtime behavior, or even those that would impact runtime behavior but only if a particular branch is hit) are not useful enough to the user to warrant changing the semantics of the application being run by changing what is output on
It depends on the tool, I might not own all the tools that are executing programs and reading from |
I think your best bet then would be to do the compilation separately and feed resultant kernel to the vm. |
I'm sorry, I just discovered that standalone dart embedder has
So that makes discussion above slightly irrelevant. Again, sorry about that. |
To me it seems like the issue here is that we have two different modes of working with the same dart executable. No single behavior of the The discoverability of the flag is low. The usability impact of not displaying warnings is high (we assume most users will want to fix the warnings). That suggests that the default should be to show warnings. There is a cost to this because people running in production might not be aware of the flag until they get hit by a new warning. Adding warnings is non-breaking for the language (they do not change the behavior of any running program), but not necessarily for the A different, possibly more practical, solution could be to have two different dart executables, |
Awesome! That definitely helps. I'm happy to see further consideration of changing the default. My preference skews towards suppressing by default, but given that the flag exists I'm not prepared to argue quite as strongly. We could also consider defaulting this for
I think this has come up before - the idea of having a single flag to wrap up the things a developer would generally use - like |
I think having a flag to suppress warnings is the right thing here. For what it's worth, that seems to be what java does, we could look at other languages. For programs that parse output, the best practice should be to run with that flag. |
The |
We have changed the language specification so that tools are no longer required to report all specified warnings. More context is here. If CFE or the VM no longer want to report warnings, they are now free to do so while still respecting the language specification. |
Since we are (as far as I know) considering it non-breaking to add new warnings in CFE we should not be printing warnings when running code. It's probably ok to print them when compiling to kernel only.
If I have some process which runs the Dart vm and processes the output, it would be breaking to me to have new warnings printed when I upgrade my SDK. I think the exact output of the Dart VM should be considered part of what is stable for the SDK. If we want to be able to add new warnings without breaking SDK version bumps we shouldn't print warnings during execution.
The text was updated successfully, but these errors were encountered: