From 482a6a0e932ee7f68a8da73f17f6d5aadf42f3ea Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 29 Jan 2024 18:51:05 +0100 Subject: [PATCH] Don't search for implicit conversions to NoType --- .../src/dotty/tools/dotc/typer/Implicits.scala | 2 +- tests/neg/i19320.scala | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/neg/i19320.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 389669beff01..c3bf2dd822c9 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -1074,7 +1074,7 @@ trait Implicits: if (argument.isEmpty) i"missing implicit parameter of type $pt after typer at phase ${ctx.phase.phaseName}" else i"type error: ${argument.tpe} does not conform to $pt${err.whyNoMatchStr(argument.tpe, pt)}") - val usableForInference = !pt.unusableForInference + val usableForInference = pt.exists && !pt.unusableForInference && (argument.isEmpty || !argument.tpe.unusableForInference) val result0 = if usableForInference then diff --git a/tests/neg/i19320.scala b/tests/neg/i19320.scala new file mode 100644 index 000000000000..e802215a1f10 --- /dev/null +++ b/tests/neg/i19320.scala @@ -0,0 +1,15 @@ +//> using scala "3.3.1" +//> using dep org.http4s::http4s-ember-client:1.0.0-M40 +//> using dep org.http4s::http4s-ember-server:1.0.0-M40 +//> using dep org.http4s::http4s-dsl:1.0.0-M40 + +//import cats.effect.* +//import cats.implicits.* + +class Concurrent[F[_]] + +class Test[F[_]: Concurren]: // error + def hello = ??? + +object Test: + def apply[F[_]: Concurrent] = new Test[F]