Skip to content

Refine type inference rules for IFTs #3448

Closed
@odersky

Description

@odersky

The following does not work currently:

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions