diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-26 12:14:13 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-30 03:50:35 -0800 |
commit | d4437aaa4bd28dc41da13ca28a752e14b5b8e30c (patch) | |
tree | bb3efbfd35539890387226ff0aaf6b18f6fef6c5 /test/files/run/t5604.scala | |
parent | e156cd13a37048b6ea822fdc8caaee40bb6a70a4 (diff) | |
download | scala-d4437aaa4bd28dc41da13ca28a752e14b5b8e30c.tar.gz scala-d4437aaa4bd28dc41da13ca28a752e14b5b8e30c.tar.bz2 scala-d4437aaa4bd28dc41da13ca28a752e14b5b8e30c.zip |
SI-5604, selections on package objects.
[backport]
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.
Diffstat (limited to 'test/files/run/t5604.scala')
-rw-r--r-- | test/files/run/t5604.scala | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/files/run/t5604.scala b/test/files/run/t5604.scala new file mode 100644 index 0000000000..a06c8aab3e --- /dev/null +++ b/test/files/run/t5604.scala @@ -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) + } +} |