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
public classC<K, V> {
public C(C<?extendsK, ?extendsV> other) {}
//public C(int i) {} uncomment and a different error appears at the call site, as this is chosen by overload resolution
}
qbin/scalac sandbox/C.java sandbox/D.scala
sandbox/D.scala:2: error: inferred type arguments [_$2,_$1] do not conform to class C's type parameter bounds [K,V]
new C(null)
^
sandbox/D.scala:3: error: inferred type arguments [_$2,_$1] do not conform to class E's type parameter bounds [K,V]
new E(null)
^
two errors found
Maybe its more a limitation than a bug. The interaction with overloading (silently choosing an alternative) is pretty unfortunate.
The text was updated successfully, but these errors were encountered:
@retronym said (edited on Feb 5, 2014 7:59:25 PM UTC):
There is only one constructor which in each class; both are polymorphic (because the class has tparams)
Providing type args explicitly sidesteps the inference failure.
It's of course a bit embarrassing that Javac happily lets you omit the typeargs. But maybe it falls into raw-type mode. I wonder: does javac have -Xprint:typer that I can play with?
Maybe its more a limitation than a bug. The interaction with overloading (silently choosing an alternative) is pretty unfortunate.
The text was updated successfully, but these errors were encountered: