diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-01 09:10:45 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-13 17:57:17 -0700 |
commit | 267650cf9c3b07e360a59f3c5b70b37fea9de453 (patch) | |
tree | 706f9f2a8527467b75069fe561dca1746211112c /test/files/run/t6206.scala | |
parent | df88808f8e34f23338956d736a6939d73c6af611 (diff) | |
download | scala-267650cf9c3b07e360a59f3c5b70b37fea9de453.tar.gz scala-267650cf9c3b07e360a59f3c5b70b37fea9de453.tar.bz2 scala-267650cf9c3b07e360a59f3c5b70b37fea9de453.zip |
Fix for SI-6206, inconsistency with apply.
The code part of this patch is 100% written by retronym, who
apparently has higher standards than I do because I found it just
lying around in his repository. I think I'll go pick through his
trash and see if he's throwing away any perfectly good muffins.
I made the test case more exciting so as to feel useful.
Diffstat (limited to 'test/files/run/t6206.scala')
-rw-r--r-- | test/files/run/t6206.scala | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/files/run/t6206.scala b/test/files/run/t6206.scala new file mode 100644 index 0000000000..07ff246d02 --- /dev/null +++ b/test/files/run/t6206.scala @@ -0,0 +1,37 @@ +class Outer { + def apply( position : Inner ) {} + class Inner + + this.apply(new Inner) + this (new Inner) // error, +} + + +class Outer1 { + + self => + + def apply( position : Inner ) : String = "outer" + + class Inner( ) { + + def apply(arg: Inner): String = "inner" + + def testMe = { + List( + self.apply( this ), // a) this works + self( this ), // b) this does not work! + this apply this, + this(this) + ) foreach println + } + } +} + +object Test { + def main(args: Array[String]): Unit = { + val o = new Outer1 + val i = new o.Inner + i.testMe + } +} |