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

Debug.eval not seeing local variables if run in project mode #5301

Open
wdanilo opened this issue Feb 5, 2023 · 0 comments
Open

Debug.eval not seeing local variables if run in project mode #5301

wdanilo opened this issue Feb 5, 2023 · 0 comments
Labels
--bug Type: bug -compiler p-low Low priority

Comments

@wdanilo
Copy link
Member

wdanilo commented Feb 5, 2023

This task is automatically imported from the old Task Issue Board and it was originally created by Radosław Waśko.
Original issue is here.


Create a new Enso project consisting of two files F1.enso and Main.enso with the following contents:

F1.enso:

from Standard.Base import all
import Standard.Base.Runtime.Debug

foo =
    c = 1
    f x y =
      if x == 0 then y else
         Debug.eval "f (x-1) (x+y+c)"
    IO.println (f 10 0)

main =
    foo

Main.enso:

from Standard.Base import all
import project.F1

main = 
    F1.foo

Then run the project in the following ways:

enso run src/F1.enso
enso run src/Main.enso

The first invocation should work and print 65 (along with a warning that c is unused, that is expected).
The second invocation may sometimes work, but often (unfortunately this seems non-deterministic so many tries may be needed, usually should be observable in every 1-3 runs) it will fail with the following error:

In module local.Project_123.F1:
Compiler encountered warnings:
F1.enso[5:5-5:5]: Unused variable c.
Compiler encountered errors:
<interactive_source>[1:1-1:1]: The name `f` could not be found.
<interactive_source>[1:4-1:4]: The name `x` could not be found.
<interactive_source>[1:10-1:10]: The name `x` could not be found.
<interactive_source>[1:12-1:12]: The name `y` could not be found.
<interactive_source>[1:14-1:14]: The name `c` could not be found.
Execution finished with an error: Compilation aborted due to errors.
        at <enso> Debug.eval(Internal)
        at <enso> f<arg-2>(/home/radeusgd/NBO/repr/Project123/src/F1.enso:8:10-37)
        at <enso> Boolean.if_then_else(Internal)
        at <enso> f(/home/radeusgd/NBO/repr/Project123/src/F1.enso:7-8)
        at <enso> F1.foo<arg-1>(/home/radeusgd/NBO/repr/Project123/src/F1.enso:9:17-22)
        at <enso> F1.foo(/home/radeusgd/NBO/repr/Project123/src/F1.enso:9:5-23)
        at <enso> Main.main(Main.enso:5:5-10)

I'm using the Enso launcher to run the project, but running directly using the engine runner should probably give the same results.

Comments:

Note: the same applies if we change F1.enso to:

from Standard.Base import all
import Standard.Base.Runtime.Debug

foo =
    c = 1
    f = x -> y ->
      if x == 0 then y else
         Debug.eval "f (x-1) (x+y+c)"
    IO.println (f 10 0)

main =
    foo

The two syntaxes are probably equivalent (as they should be). (Radosław Waśko - Nov 29, 2022)


Not for release - worth investigating at some point. (James Dunkerley - Feb 3, 2023)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -compiler p-low Low priority
Projects
None yet
Development

No branches or pull requests

2 participants