summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/run/spec-t3896.check2
-rw-r--r--test/files/run/spec-t3896.scala18
2 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/spec-t3896.check b/test/files/run/spec-t3896.check
new file mode 100644
index 0000000000..bb101b641b
--- /dev/null
+++ b/test/files/run/spec-t3896.check
@@ -0,0 +1,2 @@
+true
+true
diff --git a/test/files/run/spec-t3896.scala b/test/files/run/spec-t3896.scala
new file mode 100644
index 0000000000..4c4dadbe13
--- /dev/null
+++ b/test/files/run/spec-t3896.scala
@@ -0,0 +1,18 @@
+// see ticket #3896. Tests interaction between overloading, specialization and default params
+trait Atomic[@specialized(Boolean) T] {
+ def x: T
+
+ // crash depends on the overloading: if second method is "g", no crash.
+ def f(fn: T => T): Boolean = f(fn(x))
+ def f[R](a: T, b: R = true) = b
+}
+class AtomicBoolean(val x: Boolean) extends Atomic[Boolean]
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val e = new AtomicBoolean(false)
+ val x = e.f( (a : Boolean) => !a ) // ok
+ println( e.f( (a : Boolean) => !a ) toString ) // ok
+ println( e.f( (a : Boolean) => !a) ) // compiler crash
+ }
+}