NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed and remember flexibility of type parameters based on flexibility of its upper bounds

^KT-32435 Fixed
This commit is contained in:
Victor Petukhov
2019-12-16 11:46:10 +03:00
parent 68576da494
commit 437a26684d
41 changed files with 985 additions and 85 deletions
@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: Function.java
public interface Function<Param, Result> {
Result fun(Param param);
}
// FILE: AdapterProcessor.java
public class AdapterProcessor<T, S> {
public AdapterProcessor(Function<? super T, ? extends S> conversion) {}
}
// FILE: main.kt
interface PsiMethod {
val containingClass: PsiClass?
}
interface PsiClass
fun test() {
// TODO: don't forget to implement preservation flexibility of java type parameters in FIR (this is the reason of error here)
val processor = AdapterProcessor<PsiMethod, PsiClass>(
Function { method: PsiMethod? -> method?.containingClass }
)
}