Skip to content

Conversation

som-snytt
Copy link
Contributor

Fixes #22429

by not suggesting inaccessible extension methods unless that's all you've got.

@som-snytt
Copy link
Contributor Author

Just the accessibility test incurs a cycle.

@som-snytt
Copy link
Contributor Author

i22920.scala

//> using options -Wunused:all -Vprint:typer
import scala.util.*

object delay {
  class Async[-Ctx, +A]

  @FunctionalInterface
  trait Callback[-A] {
    def complete(tr: Try[A]): Unit
  }

  implicit object syntax:
    extension [Ctx, A](inline async: Async[Ctx, A])
      inline def run(using inline ctx: Ctx)(inline cb: Callback[A]): Unit = ???
  /*
  extension [Ctx, A](inline async: Async[Ctx, A])
    inline def run(using inline ctx: Ctx)(inline cb: Callback[A]): Unit = ???
      */
}


@main def Test = {
  import delay.Async
  //val initializeOutbound: Async[Any, String] = ???
  val initializeOutbound: Async[String, String] = ???
  initializeOutbound.run:
  //delay.syntax.run(initializeOutbound):  // shows No given instance for ctx, the underlying problem
    case Success(target) => ???
    case Failure(exception) => ???
}

It suggests importing the extension, which is in implicit scope.

The messaging is slightly different in the Any version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing private extension function is suggested even after importing
1 participant