From 11ac963c811f2a9a00fac5bb874efeaab35c4041 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sat, 26 Jan 2013 16:56:20 +0100 Subject: [backport] Fix for SI-6206, inconsistency with apply. Squashed commit of the following: commit f6bbf85150cfd7e461989ec1d6765ff4b4aeba51 Author: Paul Phillips Date: Mon Oct 1 09:10:45 2012 -0700 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. (cherry picked from commit 267650cf9c3b07e360a59f3c5b70b37fea9de453) --- test/files/run/t6206.check | 4 ++++ test/files/run/t6206.scala | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/files/run/t6206.check create mode 100644 test/files/run/t6206.scala (limited to 'test/files') diff --git a/test/files/run/t6206.check b/test/files/run/t6206.check new file mode 100644 index 0000000000..8064573667 --- /dev/null +++ b/test/files/run/t6206.check @@ -0,0 +1,4 @@ +outer +outer +inner +inner 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 + } +} -- cgit v1.2.3