Skip to content

Commit

Permalink
Don't search for implicit conversions to NoType (#19563)
Browse files Browse the repository at this point in the history
There's a good chance this will fix #19320. My problem is that without a
lot of added boilerplate I cannot test it, since it's hard to have at
the same time external dependencies and ad-hoc instrumentation in the
compiler. But what I could observe from the minimized example, it
searches for a conversion of `Concurrent[F[_]]` to `NoType` and that
must have caused the blowup.

In any case, the change makes obvious sense, so let's add that and see
whether it improves things.
  • Loading branch information
odersky authored Jan 30, 2024
2 parents b20747d + 482a6a0 commit fbe06c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions tests/neg/i19320.scala
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit fbe06c0

Please sign in to comment.