From 115d774e47e2b3ada792af776aab9a2a289a83c4 Mon Sep 17 00:00:00 2001 From: Ingo Maier Date: Tue, 4 May 2010 15:06:23 +0000 Subject: Fixed #3274. No review. --- src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala | 4 +++- test/files/pos/t3274.scala | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/files/pos/t3274.scala 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 -- cgit v1.2.3