aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-27 13:57:49 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-27 14:01:42 +0200
commit06e76c80f01a54be53391cf74d22f4b6e226c7a0 (patch)
treef4b7fff9cda25f79ee47ad8d5fff0db2e21d4571 /src
parentc653a95ad4cfcaf881f77a6ab698945480b716e4 (diff)
downloaddotty-06e76c80f01a54be53391cf74d22f4b6e226c7a0.tar.gz
dotty-06e76c80f01a54be53391cf74d22f4b6e226c7a0.tar.bz2
dotty-06e76c80f01a54be53391cf74d22f4b6e226c7a0.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala17
1 files changed, 10 insertions, 7 deletions
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)