Inkuire icon indicating copy to clipboard operation
Inkuire copied to clipboard

Support contextual parameters in scala3

Open prolativ opened this issue 4 years ago • 2 comments

A method like

def foo(using Foo): Bar

should be searchable as Foo ?=> Bar

prolativ avatar Jul 16 '21 12:07 prolativ

In my opinion, this is a tricky one and that's why I'll probably leave it for a future release. In this case Foo ?=> Bar seems like the correct signature, but let's take another example >>= in cats. For a query List[A] => (A => List[B]) => List[B] one should expect for >>= to be a valid result, but in order to achieve that some sort of implicit instances lookup would be neccessary.

KacperFKorban avatar Jul 16 '21 12:07 KacperFKorban

New idea: The true/false matching phase should not check context parameters. There are too many cases to distinguish from and could affect performance too much. The new sorting phase should group searches based on:

  • if the context parameter exists in (companion object or standard package or static import)
  • if the context parameter is defined in the query e.g. query like Context ?=> ValDef => Symbol
  • if no such criterium is met ^^^^^^ may not be exhaustive, new cases may be needed

KacperFKorban avatar Aug 13 '21 07:08 KacperFKorban