From 06e76c80f01a54be53391cf74d22f4b6e226c7a0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 27 Apr 2016 13:57:49 +0200 Subject: Fix misprediction of dependent method type status. #1235.scala contains a case of a method type of the form (x: T) ... x.tail.N ... where N is an alias. We need to follow the alias to prevent a mischaracterization that this is a dependent method type. --- src/dotty/tools/dotc/core/Types.scala | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 913339409..f99e8eba6 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2240,18 +2240,21 @@ object Types { if (myDependencyStatus != Unknown) myDependencyStatus else { val isDepAcc = new TypeAccumulator[DependencyStatus] { - def apply(x: DependencyStatus, tp: Type) = - if (x == TrueDeps) x + def apply(status: DependencyStatus, tp: Type) = + if (status == TrueDeps) status else tp match { case MethodParam(`thisMethodType`, _) => TrueDeps - case tp @ TypeRef(MethodParam(`thisMethodType`, _), name) => + case tp: TypeRef => + val status1 = foldOver(status, tp) tp.info match { // follow type alias to avoid dependency - case TypeAlias(alias) => combine(apply(x, alias), FalseDeps) - case _ => TrueDeps + case TypeAlias(alias) if status1 == TrueDeps && status != TrueDeps => + combine(apply(status, alias), FalseDeps) + case _ => + status1 } - case tp: TypeVar if !tp.isInstantiated => combine(x, Provisional) - case _ => foldOver(x, tp) + case tp: TypeVar if !tp.isInstantiated => combine(status, Provisional) + case _ => foldOver(status, tp) } } val result = isDepAcc(NoDeps, resType) -- cgit v1.2.3