summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-02-02 14:27:39 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-02 15:13:29 +0100
commitb0c4353ea1ad0af81cef31e460746d887ef151e2 (patch)
tree68a51f2ae5f6064c8f8be8ea5074c9b2a70c2520 /src/compiler
parentf59aeb58681d1dba8d32886de4785f6fb8dc9eff (diff)
downloadscala-b0c4353ea1ad0af81cef31e460746d887ef151e2.tar.gz
scala-b0c4353ea1ad0af81cef31e460746d887ef151e2.tar.bz2
scala-b0c4353ea1ad0af81cef31e460746d887ef151e2.zip
SI-8228 Avoid infinite loop with erroneous code, overloading
`isApplicableBasedOnArity` couldn't get of the ferris wheel after as `followApply` kept insisting on another spin. scala> ErrorType nonPrivateMember nme.apply res0: $r.intp.global.Symbol = value apply scala> res0.info res1: $r.intp.global.Type = <error> This commit makes `followApply` consider that an `ErrorType` does not contain an `apply` member. I also considered whether to do a deep check on the type (`isErroneous`), but I can't motivate this with a test. I tend to think we *shouldn't* do that: `List[${ErrorType}]` still has an `apply` member that we should follow, right?
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index dd0923a696..997fd6fc65 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -595,6 +595,7 @@ trait Infer extends Checkable {
}
private[typechecker] def followApply(tp: Type): Type = tp match {
+ case _ if tp.isError => tp // SI-8228, `ErrorType nonPrivateMember nme.apply` returns an member with an erroneous type!
case NullaryMethodType(restp) =>
val restp1 = followApply(restp)
if (restp1 eq restp) tp else restp1