diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-17 20:09:41 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-18 09:47:50 +0200 |
commit | 746f53e0cee601c189dac7a011f5be79591ece4c (patch) | |
tree | 40511a5e5a4b9f867b542fc127873b0733e66636 /test | |
parent | 9dbc321504ad5550638d6d7c2b3cd2f98273cf74 (diff) | |
download | scala-746f53e0cee601c189dac7a011f5be79591ece4c.tar.gz scala-746f53e0cee601c189dac7a011f5be79591ece4c.tar.bz2 scala-746f53e0cee601c189dac7a011f5be79591ece4c.zip |
SI-7853 An unsatisfying fix regression in explicit outer
The attempt to placate pos/t4970.scala in 55c6fd4 roused another
dragon.
We've got two levers here: the type of the symbol of the outer
accessor, and the type of its DefDef.
They have been historically out of sync due to the vaguaries of
finalResultType (which is far less vague since 671e6e03c7), but
the finicky operation of ExplicitOuter now has a hard time when
we try to bring them into line.
This stuff is notoriously difficult to understand because the
trees you see from `-Xprint` show a tpt derived from the method
symbol's info, and discards the actual tpt in the tree.
Rather than letting `DefDef(acc)` call `TypeTree(sym)` and use
`sym.tpe_*.finalResultType`, this commit computes the member type
of the accessor from the current class and explicitly uses that as
the return type of the outer accessor def.
We should try to push this a little deeper. I tried to put it into
`def TypeTree`, but that broke, among others,
run/concurrent-stream.scala. Maybe `def DefDef` and `def ValDef`?
But a localised fix is the right start as it addresses the regression
in a minimal fashion to get the IDE building again.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t4970b.scala | 32 | ||||
-rw-r--r-- | test/files/pos/t7853.scala | 11 | ||||
-rw-r--r-- | test/files/run/compiler-asSeenFrom.check | 4 |
3 files changed, 45 insertions, 2 deletions
diff --git a/test/files/pos/t4970b.scala b/test/files/pos/t4970b.scala new file mode 100644 index 0000000000..cf9a6a6ae9 --- /dev/null +++ b/test/files/pos/t4970b.scala @@ -0,0 +1,32 @@ +object Traits { + trait OuterClass[V <: OuterClass[V]#InnerClass] { + trait InnerClass {self: V => + def method = () + } + } + + trait SubOuterClass[T <: SubOuterClass[T]#SubInnerClass] extends OuterClass[T] { + trait SubInnerClass extends super.InnerClass {self: T => } + } + + trait SubOuterClass2[T <: SubOuterClass2[T]#SubInnerClass2] extends OuterClass[T] { + trait SubInnerClass2 extends super.InnerClass {self: InnerClass with T => } + } + +} + +// object Classes { +// class OuterClass[V <: OuterClass[V]#InnerClass] { +// class InnerClass {self: V => +// def method = () +// } +// } + +// class SubOuterClass[T <: SubOuterClass[T]#SubInnerClass] extends OuterClass[T] { +// class SubInnerClass extends super.InnerClass {self: T => } +// } + +// class SubOuterClass2[T <: SubOuterClass2[T]#SubInnerClass2] extends OuterClass[T] { +// class SubInnerClass2 extends super.InnerClass {self: InnerClass with T => } +// } +// } diff --git a/test/files/pos/t7853.scala b/test/files/pos/t7853.scala new file mode 100644 index 0000000000..b0e9221e22 --- /dev/null +++ b/test/files/pos/t7853.scala @@ -0,0 +1,11 @@ +trait S { + trait T { + this: Any => + + trait U { + trait V { + S.this + } + } + } +} diff --git a/test/files/run/compiler-asSeenFrom.check b/test/files/run/compiler-asSeenFrom.check index a1826c2784..7305504115 100644 --- a/test/files/run/compiler-asSeenFrom.check +++ b/test/files/run/compiler-asSeenFrom.check @@ -363,8 +363,8 @@ value jZ { // after parser value jZ { // after explicitouter protected val $outer: D.this.type - val $outer(): ll.D[T3] - val $outer(): ll.C[T1] + val $outer(): D.this.type + val $outer(): C.this.type def thisI(): I.this.type def thisC(): C.this.type def t2(): T2 |