diff options
author | Paul Phillips <paulp@improving.org> | 2013-09-04 08:22:27 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-09-04 09:34:04 -0700 |
commit | c58b7b10249adefa1045942a1dc7a55dc5932db8 (patch) | |
tree | 0808b4a7225eb7bd9d30fd4d937344b2ebe8c40d /test/files/run/existential-rangepos.check | |
parent | a8c05274f738943ae58ecefda4b012b9daf5d8dc (diff) | |
download | scala-c58b7b10249adefa1045942a1dc7a55dc5932db8.tar.gz scala-c58b7b10249adefa1045942a1dc7a55dc5932db8.tar.bz2 scala-c58b7b10249adefa1045942a1dc7a55dc5932db8.zip |
Eliminate TypeTrees with null original.
This is a retry of #2801 after figuring out the range position
error. Should there be anyone out there who compiles with -Xdev,
know that this commit eliminates the 1406 errors one presently
incurs compiling src/library.
A val declared in source code receives only one tree from the
parser, but two are needed - one for the field and one for the
getter. I discovered long ago that if the val had an existential
type, this was creating issues with incompatible existentials
between the field and the getter. However the remedy for that
did not take into account the whole of the wide range of super
subtle issues which accompany tree duplication.
In particular, the duplicated tree must be given not only a
fresh TypeTree(), but that TypeTree cannot share the same
original without running afoul of range position invariants.
That's because typedTypeTree resurrects the original tree with
whatever position it has - so the "original" needs to be a
duplicate of the original with a focused position.
Should the call to TypeTree.duplicate also duplicate the original?
I think so, but I bequeath this question to others.
This commit also eliminated some duplicate error messages, because
duplicate suppression depends on the errors having the same position.
See c478eb770d, 7a6fa80937 for previous related work.
Diffstat (limited to 'test/files/run/existential-rangepos.check')
-rw-r--r-- | test/files/run/existential-rangepos.check | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/files/run/existential-rangepos.check b/test/files/run/existential-rangepos.check new file mode 100644 index 0000000000..1212b60bae --- /dev/null +++ b/test/files/run/existential-rangepos.check @@ -0,0 +1,13 @@ +[[syntax trees at end of patmat]] // newSource1.scala +[0:76]package [0:0]<empty> { + [0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef { + [76]def <init>(): [20]A[T] = [76]{ + [76][76][76]A.super.<init>(); + [20]() + }; + [24:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null; + [28]<stable> <accessor> def foo: [28]Set[_ <: T] = [28][28]A.this.foo; + [54:74]<stable> <accessor> def bar: [58]Set[_ <: T] + } +} + |