diff options
author | Paul Phillips <paulp@improving.org> | 2013-10-05 16:46:46 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-10-05 16:46:46 -0700 |
commit | e609f1f20b0dce4905271b92aebd0298c7862859 (patch) | |
tree | 70575372a93261f656805ab9f709f967f24f38b6 /test/files/run | |
parent | 90a312669b37d6e3e3f08685953ded24759e6102 (diff) | |
download | scala-e609f1f20b0dce4905271b92aebd0298c7862859.tar.gz scala-e609f1f20b0dce4905271b92aebd0298c7862859.tar.bz2 scala-e609f1f20b0dce4905271b92aebd0298c7862859.zip |
Generalize OverridingPairs to SymbolPairs.
Increases your chance of knowing what is going on in
OverridingPairs. Introduces some new abstractions which I
hope for your own sakes you will put to use in some way:
RelativeTo: operations relative to a prefix
SymbolPair: two symbols being compared for something, and
the enclosing class where the comparison is being performed
Fixed a minor bug with access by accident by way of more
principled pair analysis. See run/private-override.scala.
Upgraded the error message issued on certain conflicts
to give the line numbers of both conflicting methods, as
opposed to just one and you go hunting.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/private-override.check | 1 | ||||
-rw-r--r-- | test/files/run/private-override.scala | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/private-override.check b/test/files/run/private-override.check new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/files/run/private-override.check @@ -0,0 +1 @@ +3 diff --git a/test/files/run/private-override.scala b/test/files/run/private-override.scala new file mode 100644 index 0000000000..0a3f57f97c --- /dev/null +++ b/test/files/run/private-override.scala @@ -0,0 +1,17 @@ +package test.p1.p2 { + abstract class A { + private[p2] def f2(): Int = 1 + } + abstract class Other extends A { + // It's a private method - not a private[p2] method. Not a failed + // "weaker access privileges" override, a different namespace. + private def f2(): Int = super.f2() + 2 + def go() = f2() + } +} + +object Test extends test.p1.p2.Other { + def main(args: Array[String]): Unit = { + println(go()) + } +} |