Skip to content

Conversation

@anatoliykmetyuk
Copy link
Contributor

We cannot resolve implicit parameters outside Typer. Hence methods
that require implicit parameters should not be considered.

…loaded

We cannot resolve implicit parameters outside Typer. Hence methods
that require implicit parameters should not be considered.
.map(denot => TermRef(receiver.tpe, denot.symbol))
.filter(tr => typeParamCount(tr) == targs.length)
.filter { _.widen match {
case MethodTpe(_, _, x: MethodType) => !x.isImplicitMethod
Copy link
Contributor

@odersky odersky Jul 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about curried methods that have implicit parameters as the 3rd parameter clause? Should we accept them? I guess there's no problem with those since we would not have to resolve them right away, right? If yes, it would be good to state this here as an explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can be a problem... It looks like applyOverloaded resolves a method name looking only at the first argument group. E.g.:

def f(x: Int)(y: Int) given Z: Int
def f(x: String)(y: Int): Int
applyOverloaded("f", x: Any)

In both cases, the logic above infers x.isImplicitMethod to be false, so it cannot differentiate and can select the one with the implicit args at the end. Which it will never be able to call if we are after Typer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK. So we need to exclude all implicit methods, even of the implicit comes later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@odersky do you think this is no longer a problem?

@odersky odersky assigned anatoliykmetyuk and unassigned odersky Aug 2, 2019
@odersky odersky merged commit b5842bb into scala:master Aug 30, 2019
@odersky odersky deleted the i6816 branch August 30, 2019 14:19
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.

2 participants