From ababb2ce2675619c997cb4bfa143b454e4076850 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 22 Jul 2014 18:43:24 +0200 Subject: Defined substitution which follows aliases Used in FullParameterization to substitute type parameters. Fixes test failure for t2399.scala --- src/dotty/tools/dotc/core/Types.scala | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (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 1d1c326a0..8149cce78 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -818,10 +818,17 @@ object Types { } } -/* Not needed yet: + /** Same as `subst` but follows aliases as a fallback. When faced with a reference + * to an alias type, where normal substiution does not yield a new type, the + * substitution is instead applied to the alias. If that yields a new type, + * this type is returned, outherwise the original type (not the alias) is returned. + * A use case for this method is if one wants to substitute the type parameters + * of a class and also wants to substitute any parameter accessors that alias + * the type parameters. + */ final def substDealias(from: List[Symbol], to: List[Type])(implicit ctx: Context): Type = - new ctx.SubstDealiasMap(from, to).apply(this) -*/ + ctx.substDealias(this, from, to, null) + /** Substitute all types of the form `PolyParam(from, N)` by * `PolyParam(to, N)`. */ -- cgit v1.2.3