summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2009-11-06 18:00:43 +0000
committerIulian Dragos <jaguarul@gmail.com>2009-11-06 18:00:43 +0000
commitd42f62bbd76df85ed57162118a8c720f50bbd5c5 (patch)
tree7f250f596a8dafbe3503bdd66e9f67bfa2c3f236 /test/files
parent1b807250a30c8526851e67271f0545c67362b365 (diff)
downloadscala-d42f62bbd76df85ed57162118a8c720f50bbd5c5.tar.gz
scala-d42f62bbd76df85ed57162118a8c720f50bbd5c5.tar.bz2
scala-d42f62bbd76df85ed57162118a8c720f50bbd5c5.zip
Fixed initial variable binding for method param...
Fixed initial variable binding for method parameters, that caused the inliner to infer wrong types for tail recursive methods
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/inliner-infer.check2
-rw-r--r--test/files/run/inliner-infer.scala29
2 files changed, 31 insertions, 0 deletions
diff --git a/test/files/run/inliner-infer.check b/test/files/run/inliner-infer.check
new file mode 100644
index 0000000000..d702bd602d
--- /dev/null
+++ b/test/files/run/inliner-infer.check
@@ -0,0 +1,2 @@
+non-empty
+empty
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
+}
+
+