forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed SI-5604, selections on package objects.
mkAttributedSelect, which creates a Select tree based on a symbol, has been a major source of package object bugs, because it has not been accurately identifying selections on package objects. When selecting foo.bar, if foo turns out to be a package object, the created Select tree must be foo.`package`.bar However mkAttributedSelect was only examining the owner of the symbol, which means it would work if the package object defined bar directly, but not if it inherited it.
- Loading branch information
Showing
8 changed files
with
111 additions
and
3 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// sandbox/t5604/T.scala | ||
package t6504 | ||
|
||
trait T { | ||
def foo: Boolean = false | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// sandbox/t5604/T.scala | ||
package t6504 | ||
|
||
trait T { | ||
def foo: Boolean = false | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// sandbox/t5604/Test.scala | ||
package t6504 | ||
|
||
object Test { | ||
def blerg1(a: Any): Any = if (foo) blerg1(0) | ||
def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// sandbox/t5604/Test.scala | ||
package t6504 | ||
|
||
object Test { | ||
def blerg1(a: Any): Any = if (foo) blerg1(0) | ||
def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// sandbox/t5604/pack.scala | ||
package t6504 | ||
|
||
object `package` extends T { | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
long | ||
double | ||
long | ||
double | ||
long | ||
double | ||
long | ||
double |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// a.scala | ||
// Fri Jan 13 11:31:47 PST 2012 | ||
|
||
package foo { | ||
object regular extends Duh { | ||
def buh(n: Long) = println("long") | ||
def buh(n: Double) = println("double") | ||
} | ||
class regular { | ||
import regular._ | ||
|
||
duh(33L) | ||
duh(3.0d) | ||
foo.regular.duh(33L) | ||
foo.regular.duh(3.0d) | ||
buh(66L) | ||
buh(6.0d) | ||
foo.regular.buh(66L) | ||
foo.regular.buh(6.0d) | ||
} | ||
|
||
trait Duh { | ||
def duh(n: Long) = println("long") | ||
def duh(n: Double) = println("double") | ||
} | ||
package object bar extends Duh { | ||
def buh(n: Long) = println("long") | ||
def buh(n: Double) = println("double") | ||
} | ||
package bar { | ||
object Main { | ||
def main(args:Array[String]) { | ||
duh(33L) | ||
duh(3.0d) | ||
foo.bar.duh(33L) | ||
foo.bar.duh(3.0d) | ||
buh(66L) | ||
buh(6.0d) | ||
foo.bar.buh(66L) | ||
foo.bar.buh(6.0d) | ||
} | ||
} | ||
} | ||
} | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
foo.bar.Main.main(null) | ||
} | ||
} |