scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.84k stars 1.05k forks source link

JSR 223 binding no longer works in Scala 3, worked in Scala 2 #17237

Open jpsacha opened 1 year ago

jpsacha commented 1 year ago

Compiler version

Tested with 3.2.2, but likely broken in other Scala 3 versions

Minimized code

This code should execute simple statement println(a) and print value 1

val eng = new ScriptEngineManager().getEngineByName("scala")
eng.put("a", 1)
eng.eval("println(a)")

Output

Execution of eng.eval("println(a)") results in error:

-- [E006] Not Found Error: -----------------------------------------------------
1 |println(b)
  |        ^
  |        Not found: b
  |
  | longer explanation available when compiling with `-explain`
1 error found

Expectation

In this case, a value a, set to 1, should be passed to the ScriptEngine evaluating the script, through binding. Script should compile and execute without errors.

subes commented 11 months ago

Referencing older issue: https://github.com/lampepfl/dotty/issues/14262