Skip to content

Restrict import suggestions or mention accessibility #22430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

@som-snytt
Copy link
Contributor Author

I have a follow-up to follow up with; I just need to comprehend the code I wrote...

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