blob: 4c4dadbe13f6a50cc8cd4ab1f322d392c51829af (
plain) (
tree)
|
|
// 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
}
}
|