summaryrefslogtreecommitdiff
path: root/test/files/run/t6506.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-01-28 09:10:37 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-02-02 13:19:06 +0100
commitfd6125428af90b02cb8969a53586f3551e275b0f (patch)
tree17acfa819519ec2d92eeac8b2e0dece89aad7b25 /test/files/run/t6506.scala
parentee24807f8706bb91b9d854eaba39f0ddd9c2a054 (diff)
downloadscala-fd6125428af90b02cb8969a53586f3551e275b0f.tar.gz
scala-fd6125428af90b02cb8969a53586f3551e275b0f.tar.bz2
scala-fd6125428af90b02cb8969a53586f3551e275b0f.zip
SI-6666 Account for nesting in setting INCONSTRUCTOR
This flag is calcualed in Namers, and assigned to class and module class symbols that are defined in self/super-calls, and in early definitions. For example, class D is INCONSTRUCTOR in each case below: class C extends Super({class D; ()}) class C(a: Any) { def this(a: Any) = this({class D; ()}) } new { val x = { class D; () } with Super(()) But, the calculation of this flag failed to account for nesting, so it was not set in cases like: class C(a: Any) { def this(a: Any) = this({val x = {class D; ()}; x}) } This patch searches the enclosing context chain, rather than just the immediate context. The search is terminated at the first non term-owned context. In the following example, this avoids marking `E` as INCONSTRUCTOR; only `D` should be. class C extends Super({class D { class E }; ()}) This closes SI-6259 and SI-6506, and fixes one problem in the recently reopened SI-6957.
Diffstat (limited to 'test/files/run/t6506.scala')
-rw-r--r--test/files/run/t6506.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/files/run/t6506.scala b/test/files/run/t6506.scala
new file mode 100644
index 0000000000..04d77c3c16
--- /dev/null
+++ b/test/files/run/t6506.scala
@@ -0,0 +1,8 @@
+object Test {
+ def main(args: Array[String]) {
+ new WL(new {} #:: S) with T
+ }
+ object S { def #::(a: Any): Any = () }
+ trait T
+ class WL(a: Any)
+}