diff options
Diffstat (limited to 'test/files/run/inliner-infer.scala')
-rw-r--r-- | test/files/run/inliner-infer.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/inliner-infer.scala b/test/files/run/inliner-infer.scala new file mode 100644 index 0000000000..107b9508ee --- /dev/null +++ b/test/files/run/inliner-infer.scala @@ -0,0 +1,29 @@ + + +/** 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 +} + + |