Description
I have opened this issue as a place to discuss how we should adapt the rules for implicit resolution.
Contextual vs Type Scope Searches
The current spec says:
First, eligible are all identifiers x that can be accessed at the point of the method call without a prefix and that denote an implicit definition or an implicit parameter. An eligible identifier may thus be a local name, or a member of an enclosing template, or it may be have been made accessible without a prefix through an import clause. If there are no eligible identifiers under this rule, then, second, eligible are also all implicit members of some object that belongs to the implicit scope of the implicit parameter's type, T.
This gives a priority: Search in context first, only is that fails search in implicit scope of type. Do we want to keep that? It prevents us from defining in a context a "fallback" rule that is less specific than rules in the implicit scope of their types, since the "fallback" would be selected before the other implicits are even considered.
Implicit Type Scope
The current spec includes the prefix p
of a type reference p.T
in the implicit scope of that type. This holds even for the package prefix. I.e. p
could be a package with a toplevel implicit in it. Referring to p.T
would bring that implicit in scope. Do we want to keep that? Or is it too suprising / abusable as a mechanism?
Ranking
Do we want to change how implicits are ranked for disambiguation? If yes, how?