@@ -486,10 +486,9 @@ object Implicits:
486
486
487
487
class DivergingImplicit (ref : TermRef ,
488
488
val expectedType : Type ,
489
- val argument : Tree ,
490
- addendum : => String = " " ) extends SearchFailureType {
489
+ val argument : Tree ) extends SearchFailureType {
491
490
def explanation (using Context ): String =
492
- em " ${err.refStr(ref)} produces a diverging implicit search when trying to $qualify$addendum "
491
+ em " ${err.refStr(ref)} produces a diverging implicit search when trying to $qualify"
493
492
}
494
493
495
494
class FailedExtension (extApp : Tree , val expectedType : Type ) extends SearchFailureType :
@@ -1100,13 +1099,7 @@ trait Implicits:
1100
1099
*/
1101
1100
def tryImplicit (cand : Candidate , contextual : Boolean ): SearchResult =
1102
1101
if checkDivergence(cand) then
1103
- val addendum = ctx.searchHistory.disqualifiedType match
1104
- case NoType => " "
1105
- case disTp =>
1106
- em """ .
1107
- |Note that open search type $disTp cannot be re-used as a by-name implicit parameter
1108
- |since it is not fully defined """
1109
- SearchFailure (new DivergingImplicit (cand.ref, wideProto, argument, addendum))
1102
+ SearchFailure (new DivergingImplicit (cand.ref, wideProto, argument))
1110
1103
else {
1111
1104
val history = ctx.searchHistory.nest(cand, pt)
1112
1105
val result =
@@ -1376,12 +1369,9 @@ trait Implicits:
1376
1369
history match
1377
1370
case prev @ OpenSearch (cand1, tp, outer) =>
1378
1371
if cand1.ref eq cand.ref then
1379
- def checkFullyDefined =
1380
- val result = isFullyDefined(tp, ForceDegree .failBottom)
1381
- if ! result then prev.disqualified = true
1382
- result
1383
1372
lazy val wildTp = wildApprox(tp.widenExpr)
1384
- if belowByname && (wildTp <:< wildPt) && checkFullyDefined then
1373
+ if belowByname && (wildTp <:< wildPt) then
1374
+ fullyDefinedType(tp, " by-name implicit parameter" , span)
1385
1375
false
1386
1376
else if prev.typeSize > ptSize || prev.coveringSet != ptCoveringSet then
1387
1377
loop(outer, tp.isByName || belowByname)
@@ -1473,15 +1463,6 @@ abstract class SearchHistory:
1473
1463
def defineBynameImplicit (tpe : Type , result : SearchSuccess )(using Context ): SearchResult =
1474
1464
root.defineBynameImplicit(tpe, result)
1475
1465
1476
- /** There is a qualifying call-by-name parameter in the history
1477
- * that cannot be used since is it not fully defined. Used for error reporting.
1478
- */
1479
- def disqualifiedType : Type =
1480
- def loop (h : SearchHistory ): Type = h match
1481
- case h : OpenSearch => if h.disqualified then h.pt else loop(h.outer)
1482
- case _ => NoType
1483
- loop(this )
1484
-
1485
1466
// This is NOOP unless at the root of this search history.
1486
1467
def emitDictionary (span : Span , result : SearchResult )(using Context ): SearchResult = result
1487
1468
@@ -1501,10 +1482,6 @@ case class OpenSearch(cand: Candidate, pt: Type, outer: SearchHistory)(using Con
1501
1482
// An example is in neg/9504.scala
1502
1483
lazy val typeSize = pt.typeSize
1503
1484
lazy val coveringSet = pt.coveringSet
1504
-
1505
- // Set if there would be a qualifying call-by-name parameter
1506
- // that cannot be used since is it not fully defined
1507
- var disqualified : Boolean = false
1508
1485
end OpenSearch
1509
1486
1510
1487
/**
0 commit comments