Skip to content

Commit 809f9fc

Browse files
committed
Use viewExists
1 parent 95c9dfb commit 809f9fc

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

+1-20
Original file line numberDiff line numberDiff line change
@@ -934,25 +934,6 @@ trait Implicits:
934934
case _ => false
935935
}
936936

937-
/** Whether a found implicit be converted to the desired type */
938-
def canBeConverted(ref: TermRef, expected: Type): Boolean = {
939-
// Using Mode.Printing will stop it from printing errors
940-
val tried = Contexts.withMode(Mode.Printing) {
941-
typed(
942-
tpd.ref(ref).withSpan(arg.span),
943-
expected,
944-
ctx.typerState.ownedVars
945-
)
946-
}
947-
val hasErrors =
948-
if tried.tpe.isInstanceOf[ErrorType] then true
949-
else tried match {
950-
case Apply(_, List(arg)) => arg.tpe.isInstanceOf[ErrorType]
951-
case _ => false
952-
}
953-
!hasErrors && expected =:= tried.tpe
954-
}
955-
956937
def ignoredConvertibleImplicits = arg.tpe match
957938
case fail: SearchFailureType =>
958939
if (fail.expectedType eq pt) || isFullyDefined(fail.expectedType, ForceDegree.none) then
@@ -964,7 +945,7 @@ trait Implicits:
964945
.filter { imp =>
965946
!isImplicitDefConversion(imp.underlying)
966947
&& imp.symbol != defn.Predef_conforms
967-
&& canBeConverted(imp, fail.expectedType)
948+
&& viewExists(imp, fail.expectedType)
968949
}
969950
else
970951
Nil

0 commit comments

Comments
 (0)