From 91ccb52bda344d74ba7a3e9859346e57051d2aff Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 7 Jan 2016 14:21:43 +0100 Subject: Support named type parameters Changes needed to support simple named type parameters. Not yet implemented: named arguments. --- src/dotty/tools/dotc/core/Types.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/core/Types.scala') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 8595da640..27828c588 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -485,7 +485,13 @@ object Types { } def goThis(tp: ThisType) = { val d = go(tp.underlying) - if (d.exists) d + if (d.exists) + if ((pre eq tp) && d.symbol.is(NamedTypeParam) && (d.symbol.owner eq tp.cls)) + // If we look for a named type parameter `P` in `C.this.P`, looking up + // the fully applied self type of `C` will give as an info the alias type + // `P = this.P`. We need to return a denotation with the underlying bounds instead. + d.symbol.denot + else d else // There is a special case to handle: // trait Super { this: Sub => private class Inner {} println(this.Inner) } -- cgit v1.2.3