You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class A
type IF[T] = implicit A => T
val x: IF[Int] = 1
val xs: List[IF[Int]] = List(x)
We get a "no implicit found for A" on the last occurrence of x. The reason is that at the point x is typed the expected type is still a type variable with an IFT as upper bound in the constraint. These are not recognized as IFTs, and consequently x is not expanded to a closure.
I think this is something that can be fixed by refining the rules.
We should treat as an implicit function types not only instances of ImplicitFunctionN and their aliases but also type variables that have an IFT as their upper bound.
The text was updated successfully, but these errors were encountered:
We now treat a type as an implicit function type also if it is
a type variable that has an IFT as upper bound in the current constraint.
This means we now create implicit closures if the expected type is
such a type.
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 9, 2017
We now treat a type as an implicit function type also if it is
a type variable that has an IFT as upper bound in the current constraint.
This means we now create implicit closures if the expected type is
such a type.
We now treat a type as an implicit function type also if it is
a type variable that has an IFT as upper bound in the current constraint.
This means we now create implicit closures if the expected type is
such a type.
The following does not work currently:
We get a "no implicit found for A" on the last occurrence of
x
. The reason is that at the pointx
is typed the expected type is still a type variable with an IFT as upper bound in the constraint. These are not recognized as IFTs, and consequentlyx
is not expanded to a closure.I think this is something that can be fixed by refining the rules.
We should treat as an implicit function types not only instances of
ImplicitFunctionN
and their aliases but also type variables that have an IFT as their upper bound.The text was updated successfully, but these errors were encountered: