summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Maier <ingo.maier@epfl.ch>2010-05-04 15:06:23 +0000
committerIngo Maier <ingo.maier@epfl.ch>2010-05-04 15:06:23 +0000
commit115d774e47e2b3ada792af776aab9a2a289a83c4 (patch)
treeb881db1bd19bca4aba595b2d093f96bb86c451a4
parent2c0731e106db1f6220f65e0997da13cf5188a39a (diff)
downloadscala-115d774e47e2b3ada792af776aab9a2a289a83c4.tar.gz
scala-115d774e47e2b3ada792af776aab9a2a289a83c4.tar.bz2
scala-115d774e47e2b3ada792af776aab9a2a289a83c4.zip
Fixed #3274. No review.
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala4
-rw-r--r--test/files/pos/t3274.scala9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index f2b896dc96..ee5bc040f5 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -324,7 +324,9 @@ abstract class ExplicitOuter extends InfoTransform
val path =
if (mixinClass.owner.isTerm) THIS(mixinClass.owner.enclClass)
else gen.mkAttributedQualifier(currentClass.thisType baseType mixinClass prefix)
- val rhs = ExplicitOuterTransformer.this.transform(path)
+ // Need to cast for nested outer refs in presence of self-types. See ticket #3274.
+ val rhs = gen.mkAsInstanceOf(ExplicitOuterTransformer.this.transform(path),
+ outerAcc.info.resultType)
// @S: atPos not good enough because of nested atPos in DefDef method, which gives position from wrong class!
rhs setPos currentClass.pos
diff --git a/test/files/pos/t3274.scala b/test/files/pos/t3274.scala
new file mode 100644
index 0000000000..15723184bb
--- /dev/null
+++ b/test/files/pos/t3274.scala
@@ -0,0 +1,9 @@
+trait A { this: B =>
+ trait X {
+ class Y1 extends Y
+ }
+}
+
+trait B extends A {
+ trait Y { def f {} }
+} \ No newline at end of file