aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/nesting.sc
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-02 11:00:34 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-02 11:17:14 +0100
commit24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813 (patch)
treeb52eef18a9e5fbf630fbdeb104bffd66b950ccdf /src/dotty/tools/dotc/core/nesting.sc
parent49e6eb07bf55cf9eabb260e7b7a8fef45923e8df (diff)
downloaddotty-24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813.tar.gz
dotty-24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813.tar.bz2
dotty-24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813.zip
Polishing of denotations
1. Dropped owner from denot#asSeenFrom. Code inspection shows that one needs to take the owner of the symbol in each alternative instead. 2. Changed fullName so that terms in the ownerchain leave a trace. Needed for disambiguating private symbols with expanded names. See worksheet nesting.sc for an example. 3. Changed fingerPrint so that only classes with children have their fingerPrints computed. Reason: When we lookup a member of a class initially, it's likely that the member is present, so a bloom filter will not buy us much and will take up memory. For parent classes it's different. We might have found the member already in the child, or in a different parent, so it's more likely that the fingerPrint is effective.
Diffstat (limited to 'src/dotty/tools/dotc/core/nesting.sc')
-rw-r--r--src/dotty/tools/dotc/core/nesting.sc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/nesting.sc b/src/dotty/tools/dotc/core/nesting.sc
new file mode 100644
index 000000000..a6fc92432
--- /dev/null
+++ b/src/dotty/tools/dotc/core/nesting.sc
@@ -0,0 +1,31 @@
+package dotty.tools.dotc.core
+
+object nesting {
+ class C {
+
+ class D {
+ private def x = "D"
+ def show = x
+ class E {
+ println(x)
+ }
+ }
+
+ val foo: D = {
+ class D extends C.this.D {
+ private def x = "foo.D"
+ class E {
+ println(x)
+ }
+ }
+ new D
+ }
+ }
+
+ val c = new C //> c : dotty.tools.dotc.core.nesting.C = dotty.tools.dotc.core.nesting$C@1a84d
+ //| a23
+ val d = c.foo //> d : dotty.tools.dotc.core.nesting.c.D = dotty.tools.dotc.core.nesting$C$D$1
+ //| @2705d88a
+ d.show //> res0: String = foo.D
+
+} \ No newline at end of file