-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
3 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
outer | |||
outer | |||
inner | |||
inner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 | |||
} | |||
} |