summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-10-24 16:34:55 +0000
committerMartin Odersky <odersky@gmail.com>2011-10-24 16:34:55 +0000
commitffb65f00615ba524298b39e676debf45af4a13cb (patch)
treec77b0888768910222cb2f0a0c82c30c3f11c03a0 /test
parent170089943bb7d447b28691b96eb8422b67e20720 (diff)
downloadscala-ffb65f00615ba524298b39e676debf45af4a13cb.tar.gz
scala-ffb65f00615ba524298b39e676debf45af4a13cb.tar.bz2
scala-ffb65f00615ba524298b39e676debf45af4a13cb.zip
First end-to-end implementation of a runtime re...
First end-to-end implementation of a runtime reflexive compiler that generates and loads bytecodes. Review by szeiger.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/code.check29
-rw-r--r--test/files/run/code.scala (renamed from test/disabled/run/code.scala)8
2 files changed, 37 insertions, 0 deletions
diff --git a/test/files/run/code.check b/test/files/run/code.check
new file mode 100644
index 0000000000..b946554fda
--- /dev/null
+++ b/test/files/run/code.check
@@ -0,0 +1,29 @@
+testing: ((x: Int) => x.$plus(ys.length))
+result = ((x: Int) => x.+{(x: <?>)Int}(ys.length{Int}){Int}){Int => Int}
+evaluated = <function1>
+testing: (() => {
+ val e: Element = new Element("someName");
+ e
+})
+result = (() => {
+ val e: Element = new Element{Element}{(name: <?>)Element}("someName"{String("someName")}){Element};
+ e{Element}
+}{Element}){() => Element}
+evaluated = Element(someName)
+testing: (() => truc.elem = 6)
+result = (() => truc.elem{Int} = 6{Int(6)}{Unit}){() => Unit}
+evaluated = null
+testing: (() => truc.elem = truc.elem.$plus(6))
+result = (() => truc.elem{Int} = truc.elem.+{(x: <?>)Int}(6{Int(6)}){Int}{Unit}){() => Unit}
+evaluated = null
+testing: (() => new baz.BazElement("someName"))
+result = (() => new baz.BazElement{baz.BazElement}{(name: <?>)baz.BazElement}("someName"{String("someName")}){baz.BazElement}){() => baz.BazElement}
+evaluated = BazElement(someName)
+testing: ((x: Int) => x.$plus(ys.length))
+result = ((x: Int) => x.+{(x: <?>)Int}(ys.length{Int}){Int}){Int => Int}
+evaluated = <function1>
+static: 2
+testing: (() => x.$plus(1))
+result = (() => x.+{(x: <?>)Int}(1{Int(1)}){Int}){() => Int}
+evaluated = 2
+1+1 = 2
diff --git a/test/disabled/run/code.scala b/test/files/run/code.scala
index 8881c2eda8..e26f97b2a4 100644
--- a/test/disabled/run/code.scala
+++ b/test/files/run/code.scala
@@ -36,8 +36,16 @@ object Test extends App {
}
show()
+
+ def evaltest(x: Int) = {
+ CodeTest.static(() => x + 1, args)
+ CodeTest(() => x + 1, args)
+ }
+
+ println("1+1 = "+evaltest(1))
}
+
package baz {
case class BazElement(name: String) { }