diff --git a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala index e7bc3f120db2..9db5d7dbf697 100644 --- a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -334,6 +334,8 @@ class ImplicitSearchError( */ private def userDefinedImplicitNotFoundTypeMessage: Option[String] = pt.baseClasses.iterator + // Don't inherit "No implicit view available..." message if subtypes of Function1 are not treated as implicit conversions anymore + .filter(sym => Feature.migrateTo3 || sym != defn.Function1) .map(userDefinedImplicitNotFoundTypeMessage(_)) .find(_.isDefined).flatten diff --git a/tests/neg/i10603a.check b/tests/neg/i10603a.check new file mode 100644 index 000000000000..34da4a2ae4a0 --- /dev/null +++ b/tests/neg/i10603a.check @@ -0,0 +1,4 @@ +-- Error: tests/neg/i10603a.scala:2:35 --------------------------------------------------------------------------------- +2 | val x = implicitly[List[Boolean]] // error + | ^ + | no implicit argument of type List[Boolean] was found for parameter e of method implicitly in object Predef diff --git a/tests/neg/i10603a.scala b/tests/neg/i10603a.scala new file mode 100644 index 000000000000..fb818f8a3667 --- /dev/null +++ b/tests/neg/i10603a.scala @@ -0,0 +1,3 @@ +object Test { + val x = implicitly[List[Boolean]] // error +} diff --git a/tests/neg/i10603b.check b/tests/neg/i10603b.check new file mode 100644 index 000000000000..14a03fc9d3d7 --- /dev/null +++ b/tests/neg/i10603b.check @@ -0,0 +1,4 @@ +-- Error: tests/neg/i10603b.scala:4:35 --------------------------------------------------------------------------------- +4 | val x = implicitly[List[Boolean]] // error + | ^ + | No implicit view available from Int => Boolean. diff --git a/tests/neg/i10603b.scala b/tests/neg/i10603b.scala new file mode 100644 index 000000000000..783f8821612f --- /dev/null +++ b/tests/neg/i10603b.scala @@ -0,0 +1,5 @@ +import language.`3.0-migration` + +object Test { + val x = implicitly[List[Boolean]] // error +} diff --git a/tests/neg/summon-function.check b/tests/neg/summon-function.check index 525b68e88c66..e081d73ad769 100644 --- a/tests/neg/summon-function.check +++ b/tests/neg/summon-function.check @@ -1,4 +1,4 @@ -- Error: tests/neg/summon-function.scala:2:23 ------------------------------------------------------------------------- 2 | summon[Int => String] // error | ^ - | No implicit view available from Int => String. + | no implicit argument of type Int => String was found for parameter x of method summon in object Predef