blob: 107b9508ee1c168b7aebe3f502cf405f5b4ddaf8 (
plain) (
tree)
|
|
/** Test that the inliner is not inferring that `xs' is
* always Nil, removing the call to isEmpty.
*/
object Test extends Application {
@annotation.tailrec
def walk(xs: MyList): Unit = {
if (xs.isEmpty)
println("empty")
else {
println("non-empty")
walk(MyNil)
}
}
walk(new MyList)
}
class MyList {
def isEmpty = false
}
object MyNil extends MyList {
override def isEmpty = true
}
|