aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/capturedVars.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-09-12 02:29:53 +0200
committerMartin Odersky <odersky@gmail.com>2014-09-12 02:29:53 +0200
commit2317764b683fe548f7c5e3b5ee5ede9760433c61 (patch)
tree812021ca83db7c3120ebe4a1797015b04856996e /tests/pos/capturedVars.scala
parentbb5b049076ca733ea42e528ecef81de438a15b19 (diff)
downloaddotty-2317764b683fe548f7c5e3b5ee5ede9760433c61.tar.gz
dotty-2317764b683fe548f7c5e3b5ee5ede9760433c61.tar.bz2
dotty-2317764b683fe548f7c5e3b5ee5ede9760433c61.zip
New phase: CapturedVars
Breaks out boxing functionality of captured vars from lambda lift.
Diffstat (limited to 'tests/pos/capturedVars.scala')
-rw-r--r--tests/pos/capturedVars.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/pos/capturedVars.scala b/tests/pos/capturedVars.scala
new file mode 100644
index 000000000..2cbcf111a
--- /dev/null
+++ b/tests/pos/capturedVars.scala
@@ -0,0 +1,25 @@
+class Test {
+
+ var field: Int = _
+
+ def foo() = {
+
+ var x: Int = 1
+ var y: String = "abc"
+ @volatile var vx: Double = 2
+ @volatile var vo: Exception = null
+ var xs: Array[Int] = Array(1, 2, 3)
+ val xs1: Object = xs
+
+ def inner() = {
+ field = x
+ x = x + 1 + field
+ y += "d"
+ vx = x * 2
+ vo = vo
+ xs(0) = xs(1)
+ xs = xs.clone
+ }
+ }
+}
+