-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
scala 3 repl does not show if a message is an error or a warning (regression from scala 2) #12981
Comments
Warning text could be in yellow, error text in red and blinking! But maybe manage that annoying behavior with |
I'm copy-pasting things around in various teaching material (also for B&W print) and also, (even) more importantly, some people are color blind so I think |
@som-snytt Is this not too hard to fix for a REPL-hacker-noob like me, do you think? I mean, I managed to find out how to prohibit mal-truncation last time with your help ⛑️ |
I don't know for sure but I would hazard a guess that this is very noob-friendly :) |
Thanks @dwijnand for encouragement. I'll hopefully find a coffee-break slot for looking into this soon. |
I have started to browse the code and the REPL has ParseResult and the compiler dotc itself has StoreReporter but I'm uncertain if this should just be a tweak to the printout at the outer rim of the REPL or it should go deep down into the rendering of error messages inside the compiler? |
I think it's a REPL thing, as the batch compiler already displays it its own way: $ scalac3 test/files/neg/t8597.1.scala
-- Warning: test/files/neg/t8597.1.scala:5:43 ----------------------------------
5 | def warn1[T] = (null: Any) match { case _: T => } // warn
| ^^^^
| the type test for T cannot be checked at runtime
1 warning found |
you can look in |
Thanks for pointers! Will try to grok it. It seems to me that the REPL should reuse all the reporting stuff from dotc sans the file name + line pos marker, but apparently the REPL just utilizes the vertical bar stuff. |
My plan is to try to fix this before or during rendering.formatError which is called from displayErrors and I'm starting to investigate it with some good old println instrumentation but it seems as the error level does not differentiate between warnings and errors; check the level output here:
Above is the output of this tweaked displayErrors during the above
Seems strange that the level attribute is not at level 1... but .... *Edit: see comments below |
Perhaps the Build's fatal warnings propagate? I'm checking currently with all fatal warnings turned off in Build.sbt. |
Yes! Turning off fatal warnings helped! Now trying to find ways to tweak the rendering... Hang on. |
SUCCESS: 😄
I have found a minimal tweak of the REPL's messageRenderer. |
@dwijnand Should I make a PR now? |
you will probably have to change the sources in in sbt shell |
@bishabosha thanks; will |
Aha I get it. Sorry. Checking errors now and fixing output. |
... a lot of manual work. Have just managed to do a tiny percentage of the tests so far. I'm considering writing a script or something. |
I've made a simple utility in |
Now here: #13000 A nice and even PR number 😄 |
@bishabosha The build fails. Are there more sbt tasks than |
The CI build fails here: Test dotty.tools.repl.ShadowingTests.i7635 failed: java.lang.AssertionError: Error in script , |
@bishabosha Found it: compiler/test/dotty/tools/repl/ShadowingTests.scala |
I'm running |
All tests pass in CI build. 🥳 |
@som-snytt Your colorful suggestion has gotten red alert attention with hope of a green light soon. (but no epi(lepti)c blink) |
fix #12981 add REPL show diagnostics level warn | err
Compiler version
3.0.0
Minimized code and output
Expectation
The first message above should include
warning
and the the second should includeerror
. It is conceptually important to understand if the code has run or not, esp. for learners but also for professionals - I don't know all messages by hart if they are warnings or errors. Now it all looks the same in the Scala 3 REPL.This is a regression from the Scala 2 REPL, in which you can always tell if a message is an error or a warning.
The text was updated successfully, but these errors were encountered: