Skip to content
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

Try reporting diagnostics in non-strict mode #8272

Merged
merged 12 commits into from
Dec 14, 2023

Conversation

radeusgd
Copy link
Member

@radeusgd radeusgd commented Nov 9, 2023

Pull Request Description

  • Makes sure that the compiler will print the diagnostics even if non-strict mode is used
    • To prevent printing unexpected stuff to stdout in interactive mode, the diagnostics are printed as 'warning' level log messages in that mode. In strict mode, the messages are printed like before, without changes.

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@radeusgd radeusgd changed the base branch from develop to wip/radeusgd/fix-from-bug November 9, 2023 18:25
@radeusgd
Copy link
Member Author

radeusgd commented Nov 9, 2023

I realised that we do seem to be reporting these errors in interactive mode (even if we don't 'hit' them), at least to some extent - as seen in https://github.com/enso-org/enso/blob/develop/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeErrorsTest.scala#L679-L695

I thought we are not.

Still, I think this could be improvement.

  1. IIRC we don't yet show these messages in the IDE in any way. So it will be helpful to see them in any form before we get the proper display.
  2. Even once we get it, I think it is beneficial to have these diagnostics in the logs. The users often attach logs when reporting issues - and the diagnostics may help in finding out the problems - so having them there (in the interactive mode) could make it easier to find issues.

@radeusgd radeusgd requested a review from jdunkerley November 9, 2023 18:32
@@ -1126,8 +1127,9 @@ class Compiler(
var str = fansi.Str()
val fileLocation = diagnostic.location match {
case Some(_) => fileLocationFromSection(diagnostic.location, source)
case None => source.getPath
case None => Option(source.getPath).getOrElse("<Unknown source>")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice observation, thx

Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the Level.WARNING change myself, but I don't mind having it in.


private def printDiagnostic(message: String): Unit =
if (config.isStrictErrors) output.println(message)
else context.log(Level.WARNING, message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flooding log with user errors is probably not very good idea in the long term.

Base automatically changed from wip/radeusgd/fix-from-bug to develop November 11, 2023 16:27
@radeusgd radeusgd force-pushed the wip/radeusgd/report-diagnostics-in-non-strict-mode branch from 79e3b06 to 53247b9 Compare November 20, 2023 12:45
…rict-mode

# Conflicts:
#	engine/runtime-compiler/src/main/scala/org/enso/compiler/Compiler.scala
@radeusgd radeusgd added CI: Ready to merge This PR is eligible for automatic merge CI: No changelog needed Do not require a changelog entry for this PR. labels Dec 7, 2023
@mergify mergify bot merged commit 95f11ab into develop Dec 14, 2023
33 of 34 checks passed
@mergify mergify bot deleted the wip/radeusgd/report-diagnostics-in-non-strict-mode branch December 14, 2023 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants