aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-18 13:56:50 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-18 13:56:50 +0200
commitb53a03f1183c062bed0120257e0519eb81e7619e (patch)
tree42145189d0347c27eac849e2a64ef0a2eb6cd0ca /tests/pos
parent91b9180d17571e2d0d74b748ceaedfccec4c2bd2 (diff)
downloaddotty-b53a03f1183c062bed0120257e0519eb81e7619e.tar.gz
dotty-b53a03f1183c062bed0120257e0519eb81e7619e.tar.bz2
dotty-b53a03f1183c062bed0120257e0519eb81e7619e.zip
Make ElimByName change owners of by-name parameters
By-name parameters did not have their owner changed before. This was not noticed in treecheck because the method generated for the closure did not have its Method flag set by accident, so owmer checking ignored the new val. Once the Methgod flag was set, owner checking failed. Once changeOwner was added, a whole lot of other things failed, which led to the fixes in the previous commits.
Diffstat (limited to 'tests/pos')
-rwxr-xr-xtests/pos/t2484.scala21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/pos/t2484.scala b/tests/pos/t2484.scala
index 15165c247..b822415fd 100755
--- a/tests/pos/t2484.scala
+++ b/tests/pos/t2484.scala
@@ -6,11 +6,32 @@ class Admin extends javax.swing.JApplet {
scala.concurrent.Future {jScrollPane.synchronized {
def someFunction () = {}
//scala.concurrent.ops.spawn {someFunction ()}
+ jScrollPane.addComponentListener {
+ class nested extends java.awt.event.ComponentAdapter {
+ override def componentShown (e: java.awt.event.ComponentEvent) = {
+ someFunction ();
+ jScrollPane.removeComponentListener (this)
+ }
+ }
+ new nested
+ }
+ }}
+ }
+}
+
+// original version, with anonymous class instead of "nested"
+class Admin2 extends javax.swing.JApplet {
+ val jScrollPane = new javax.swing.JScrollPane (null, 0, 0)
+ def t2484: Unit = {
+ scala.concurrent.Future {jScrollPane.synchronized {
+ def someFunction () = {}
+ //scala.concurrent.ops.spawn {someFunction ()}
jScrollPane.addComponentListener (new java.awt.event.ComponentAdapter {override def componentShown (e: java.awt.event.ComponentEvent) = {
someFunction (); jScrollPane.removeComponentListener (this)}})
}}
}
}
+
// t2630.scala
object Test {
def meh(xs: List[Any]): Unit = {