scala-subscript / subscript

9 stars 2 forks source link

Not possible to use variables in code blocks #5

Closed anatoliykmetyuk closed 8 years ago

anatoliykmetyuk commented 9 years ago

This:

    live = val a = {
             val x = 3
             println(x)
             x
           }

Will fail with this:

[error] (compile:compileIncremental) scala.reflect.internal.FatalError: symbol value x#23616 does not exist in Main$$anonfun$live$1.apply, which contains locals value script#23313,value _node#25474.
[error] Method code: final def apply(_node: subscript#29.vm#8491.Script#9187): subscript#29.vm#8491.model#9226.template#18034.concrete#20226.T_localvar#23452 = {
[error]   implicit val script = _node;
[error]   subscript.DSL._val($anonfun$live$1.this.a$1, {
[error]     ((new <$anon: Function1#1720>($anonfun.this, x)): Function1#1720)
[error]   })
[error] }
[error] Total time: 1 s, completed Nov 3, 2015 1:07:33 PM

Possibly due to the fact that val x = 3 is wrapped in a macro.