Skip to content

Commit

Permalink
SI-10081 Avoid diverging implicit scope search
Browse files Browse the repository at this point in the history
Storing empty infos into the infoMap (thus avoiding recomputation)
prevents the endless recursion.

This is an alternative to #5734 that
avoids the expensive annotation removal and the regression in
pos/t1203a.scala.
  • Loading branch information
szeiger committed Feb 27, 2017
1 parent 920bc4e commit ebe1180
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/compiler/scala/tools/nsc/typechecker/Implicits.scala
Expand Up @@ -1042,8 +1042,7 @@ trait Implicits {
if (sym.isPackageClass) sym.packageObject.typeOfThis
else singleType(pre, companionSymbolOf(sym, context))
val infos = pre1.implicitMembers.iterator.map(mem => new ImplicitInfo(mem.name, pre1, mem)).toList
if (infos.nonEmpty)
infoMap += (sym -> infos)
infoMap += (sym -> infos)
}
val bts = tp.baseTypeSeq
var i = 1
Expand Down
4 changes: 4 additions & 0 deletions test/files/neg/t10081.check
@@ -0,0 +1,4 @@
t10081.scala:2: error: value x is not a member of B[X]
trait B[X] extends A[B[X @unchecked]] { this.x }
^
one error found
2 changes: 2 additions & 0 deletions test/files/neg/t10081.scala
@@ -0,0 +1,2 @@
trait A[_]
trait B[X] extends A[B[X @unchecked]] { this.x }

0 comments on commit ebe1180

Please sign in to comment.