Given:
class Contra[-T >: Null]
object Test {
def foo = {
class A
new Contra[A]
}
}
The inferred type of foo is Contra[Nothing], but this isn't a legal type (and indeed writing it down would produce a Type argument Nothing does not conform to lower bound Null error).
It seems that ApproximatingTypeMap#derivedAppliedType is missing logic to replace Ranges by types which are in bounds. Moreover, -Ycheck should be enhanced to detect this kind of bound violations.
Given:
The inferred type of
fooisContra[Nothing], but this isn't a legal type (and indeed writing it down would produce aType argument Nothing does not conform to lower bound Nullerror).It seems that
ApproximatingTypeMap#derivedAppliedTypeis missing logic to replace Ranges by types which are in bounds. Moreover,-Ycheckshould be enhanced to detect this kind of bound violations.