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
We could construct AppliedTypes from Java whose arguments do not conform to type bound. When the type is used in Dotty, it is not checked.
minimized code
S.scala
classAclassD[T>:A](v: T) {
defgetV():T= v // ensure T is correctly inferred
}
objectS {
// J.getDS() : D[String] is inferred but not checkedvaldv:String=J.getDS().getV()
}
J.java
publicclassJ {
// for java, D is D<T extends Object>publicstaticD<String> getDS() {
returnnewD<String>("DS");
}
}
expectation
I expected to see a type error at J.getDS() in S.scala, since String does not conform to lower bound A. However, this test passed. I also test the same code in scalac 2.13, and it also compiled.