-
Notifications
You must be signed in to change notification settings - Fork 327
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
Print out warnings associated with local variables #10842
Conversation
After 63d1560 one can create following from Standard.Base import all
main =
j = 1
d = Warning.attach "Doubled number" 2
t = j + d
v = [j, d, t]
v and then execute: $ ./built-distribution/enso-engine-*/enso-*/bin/enso \
--run warn_test.enso \
-vm.D=polyglot.enso-debug-server.fn=warn_test.main \
--repl
> :list
d = WithWarnings{2 has 1 warnings}
t = WithWarnings{3 has 1 warnings}
v = [1, 2, 3]
j = 1 e.g. by using the |
5927a41
to
7f06236
Compare
With dbe3c45 the output of the
OK, @jdunkerley? |
f257235
to
4fda04b
Compare
The last improvement to startup we got was because of disabling the debug server by default: this PR basically enables the same debug server instrument (but without the message transfer), so let's check what is the affect on startup with followin bench run. Probably there is some slowdown in |
...ment-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java
Show resolved
Hide resolved
engine/common/src/main/java/org/enso/common/DebugServerInfo.java
Outdated
Show resolved
Hide resolved
...tion-tests/src/test/java/org/enso/interpreter/test/instrument/DebugServerWithScriptTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warnings printed upon :list
look great, I think that will be quite helpful.
In the REPL, we also print the value returned from a function. Will the warnings show up there as well??? If not, could we please make them?
E.g.
> Warning.attach 2+2 3+3
>>> 6
! 4
That would be super helpful and would give immediate feedback for the warnings in REPL without having to check :list
every time.
I'm a bit concerned about the changes to semantics of error propagation - I need to understand it further.
APIs being introduced by this PR:
Changing these APIs will have a visible effect on users of Enso. Please review with care. |
...gration-tests/src/test/java/org/enso/interpreter/test/instrument/DebugServerInspectTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for addressing the comments
Just checked and the warnings are not printed on REPL values. Any chance we could get that? Not necessarily as part of this PR. Shall I create a ticket? |
Ah, I guess the problem is that |
I am just too sloooow this afternoon. Done in 49d535b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright but please rename FN
engine/common/src/main/java/org/enso/common/DebugServerInfo.java
Outdated
Show resolved
Hide resolved
|
||
mainFile = pkg.mainFile(); | ||
if (!mainFile.exists()) { | ||
println("Main file does not exist."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this print to stderr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. However the code has been there before this PR - so the answer doesn't need to be provided by this PR.
...ment-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java
Show resolved
Hide resolved
...gration-tests/src/test/java/org/enso/interpreter/test/instrument/DebugServerInspectTest.java
Show resolved
Hide resolved
Renamed to |
Co-authored-by: Hubert Plociniczak <[email protected]>
Pull Request Description
Fixes #9749 by:
fn
option toenso-debug-server
instrument - eb3b76e:list
to print out warnings - dbe3c45DataflowError
- 2cc7ef5 and e6fbf73runner/*Main
- 7df58efThe core of the change is in instrumentation that wraps the
main
method and at its end checks for warnings or errors among local variables. When an error is found, it wraps the original return value ofmain
with a proxy that delegates to the original value, but also pretends to be exit exception with exit code 173. That one is detected inMain
launcher to exit the process with exit code 173.Important Notes
As a side-effect of this change, one can request an invocation of REPL at the end of any method just by providing a property to the VM:
stops at the end of
main
method oferr_test.enso
file.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.