diff options
author | Martin Odersky <odersky@gmail.com> | 2015-01-01 15:56:25 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-01-01 15:56:25 +0100 |
commit | bd405e5ae89093c83f7914bd515d82dcdec22f32 (patch) | |
tree | 92ac2bcb95acaa5b6f76b1803e1190f2a6422548 | |
parent | 6543f8914cf1582d364d6c0e4395cd878dd6bd4d (diff) | |
download | dotty-bd405e5ae89093c83f7914bd515d82dcdec22f32.tar.gz dotty-bd405e5ae89093c83f7914bd515d82dcdec22f32.tar.bz2 dotty-bd405e5ae89093c83f7914bd515d82dcdec22f32.zip |
Extended refinementRefersToThis to alias types.
Given
class C { type T }
C { type U = this.T } { val x: U }
the second refinement does refer via the alias to the refinement type itself.
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 99f919a86..68deae176 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1734,15 +1734,13 @@ object Types { def refinementRefersToThis(implicit ctx: Context): Boolean = { def recur(tp: Type, level: Int): Boolean = tp.stripTypeVar match { - case tp @ TypeRef(RefinedThis(_, `level`), _) => - tp.info match { - case TypeAlias(alias) => recur(alias, level) - case _ => true - } case RefinedThis(rt, `level`) => true case tp: NamedType => - !tp.symbol.isStatic && recur(tp.prefix, level) + tp.info match { + case TypeAlias(alias) => recur(alias, level) + case _ => !tp.symbol.isStatic && recur(tp.prefix, level) + } case tp: RefinedType => recur(tp.refinedInfo, level + 1) || recur(tp.parent, level) |