summaryrefslogtreecommitdiff
path: root/test/files/detach-neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/detach-neg')
-rw-r--r--test/files/detach-neg/det_bar.check4
-rw-r--r--test/files/detach-neg/det_bar.scala13
2 files changed, 17 insertions, 0 deletions
diff --git a/test/files/detach-neg/det_bar.check b/test/files/detach-neg/det_bar.check
new file mode 100644
index 0000000000..70b47581a5
--- /dev/null
+++ b/test/files/detach-neg/det_bar.check
@@ -0,0 +1,4 @@
+det_bar.scala:7: error: detach inapplicable for method bar
+ detach(bar)
+ ^
+one error found
diff --git a/test/files/detach-neg/det_bar.scala b/test/files/detach-neg/det_bar.scala
new file mode 100644
index 0000000000..1f4dd9e892
--- /dev/null
+++ b/test/files/detach-neg/det_bar.scala
@@ -0,0 +1,13 @@
+import scala.remoting._
+class A(y: Int) {
+ var z = 2
+ var bar = (x: Int) => x + y + z
+ def foo(x: Int): Int = x + y + z
+ bar = (x: Int) => x * y
+ detach(bar)
+}
+
+object test extends Application {
+ val a = new A(1)
+ println(a.bar(2))
+}