adriaanm/scala-dev — pull request #13 by namin (2011-10-17 18:49:06+00:00)
Title: bad interaction between virtualized vars and reified new

virtualized-scala allows vars to be virtualized (changing a var xx = init call to val xx = __newVar(init)). This interacts badly with reified new, because this __newVar doesn't return a Rep in the core LMS framework.

Not sure what to do, but perhaps the easiest solution would be to _not_ virtualized vars within reified new, but just rely on the self.__newVar mechanism (which seems to be eclipsed when the top-level __newVar is defined). The current interaction makes vars within reified new unusable when we have Variables in the DSL.

The test in the commit currently fails with:

virtnew_tops_newvar.scala:40: error: type mismatch;
found : Int(23)
required: Test.Variable[Int]
val foo: Rep[Row[Rep] { var xx: Int }] = new Row[Rep] { var xx = 23 }
^
virtnew_tops_newvar.scala:40: error: type mismatch;
found : Test.Rep[Object with Row[Test.Rep]{def xx: Test.Variable[Int]; def xx_=(x$1: Test.Variable[Int]): Unit}]
required: Test.Rep[Row[Test.Rep]{def xx: Int; def xx_=(x$1: Int): Unit}]
val foo: Rep[Row[Rep] { var xx: Int }] = new Row[Rep] { var xx = 23 }
^
two errors found