Syntactic sugar for generalized type constraints (=:=, <:<)

On the right-hand side of a type parameter’s : you need a unary type function.

For what it’s worth, Dotty already allows:

def foo[A: [T] => T <:< Int] = // ...

If we ever get underscore syntax type lambdas, we will be able to write:

def foo[A: _ <:< Int] = // ...
5 Likes