summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-02 13:19:07 -0700
committerPaul Phillips <paulp@improving.org>2012-05-02 13:19:07 -0700
commitbf0f008df8feb8357fcad9aa455ff63b409d59bf (patch)
treec452b12808f6a4513fd1013655a339f242978f68 /test/files/run
parent4b8c54cd9e52dbacc239d05c8149d7f249bbebab (diff)
parent77b577a5aeab782b64b39b3a812c35fdd8ab265a (diff)
downloadscala-bf0f008df8feb8357fcad9aa455ff63b409d59bf.tar.gz
scala-bf0f008df8feb8357fcad9aa455ff63b409d59bf.tar.bz2
scala-bf0f008df8feb8357fcad9aa455ff63b409d59bf.zip
Merge commit 'refs/pull/317/head' into develop
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t5543.check3
-rw-r--r--test/files/run/t5543.scala26
2 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/t5543.check b/test/files/run/t5543.check
new file mode 100644
index 0000000000..517038f4c7
--- /dev/null
+++ b/test/files/run/t5543.check
@@ -0,0 +1,3 @@
+Test, 7, 119
+m, 3, 19
+Test, 5, 85
diff --git a/test/files/run/t5543.scala b/test/files/run/t5543.scala
new file mode 100644
index 0000000000..651bc7f2b2
--- /dev/null
+++ b/test/files/run/t5543.scala
@@ -0,0 +1,26 @@
+
+object Test extends Function0[Int] {
+ // this and v resolve to Test.this, Test.v not A.this, A.v
+ class A(x: Function0[Int] = this)(val a: Int = v, val b: Int = v * x()) extends Function0[Int] {
+ val v = 3
+ override def toString = x.toString +", "+ a +", "+ b
+ // ordinary instance scope
+ def m(i: Int = v, y: Function0[Int] = this) = "m, "+ i +", "+ y()
+ def apply() = 19
+ }
+ object A {
+ val v = 5
+ // should happily coexist with default getters, in a happier world
+ def init(x: Function0[Int] = Test.this)(a: Int = v, b: Int = v * x()) = x.toString +", "+ a +", "+ b
+ override def toString = "A"
+ }
+ val v = 7
+ def apply() = 17
+ override def toString = "Test"
+ def main(args: Array[String]) {
+ val sut = new A()()
+ println(sut.toString)
+ println(sut.m())
+ println(A.init()())
+ }
+}