[FIR] fix subtyping for definitely notnull types.

The current implementation doesn't consider Foo a subtype of Captured<in
Foo>!!, since AbstractTypeCheckerContext::checkSubtypeForSpecialCases
does not handle DefinitelyNotNullType cases. This PR adds handling of
DefinitelyNotNullType by looking at its original type.

^KT-42824 Fixed
This commit is contained in:
Juan Chen
2020-10-27 04:18:31 +03:00
committed by Mikhail Glukhikh
parent eb804709da
commit 9486f58fb1
11 changed files with 79 additions and 14 deletions
@@ -0,0 +1,21 @@
// FILE: DiagnosticFactory0.java
import org.jetbrains.annotations.NotNull;
public class DiagnosticFactory0<E> {
@NotNull
public SimpleDiagnostic<E> on(@NotNull E element) {
return new SimpleDiagnostic<>(element);
}
}
// FILE: test.kt
class SimpleDiagnostic<E>(val element: E)
interface KtAnnotationEntry
fun foo(error: DiagnosticFactory0<in KtAnnotationEntry>, entry: KtAnnotationEntry) {
error.on(entry) // used to be INAPPLICABLE_CANDIDATE
}
fun box() = "OK"