FIR: Add problem test

This commit is contained in:
Denis Zharkov
2020-01-30 14:29:51 +03:00
parent e0dca92370
commit db6183644f
4 changed files with 32 additions and 0 deletions
@@ -0,0 +1,12 @@
interface Out<out E>
fun <X> id(x: Out<X>): Out<X> = TODO()
fun <F : Any> foo(computable: Out<F?>)
fun <T : Any> bar(computable: Out<T?>) {
// Should be resolved but fails during inference
// Failed incorporated constraint: T? <: Any (from T? <: X!! and X!! <: F and F <: Any)
// Hypothesis: DefinetelyNotNull(T?) = should just remove "?" while it actually gets created
<!INAPPLICABLE_CANDIDATE!>foo<!>(id(computable))
}
@@ -0,0 +1,10 @@
FILE: definetelyNotNullForTypeParameter.kt
public abstract interface Out<out E> : R|kotlin/Any| {
}
public final fun <X> id(x: R|Out<X>|): R|Out<X>| {
^id R|kotlin/TODO|()
}
public final fun <F : R|kotlin/Any|> foo(computable: R|Out<F?>|): R|kotlin/Unit|
public final fun <T : R|kotlin/Any|> bar(computable: R|Out<T?>|): R|kotlin/Unit| {
<Inapplicable(INAPPLICABLE): [/foo]>#(R|/id|<R|T?|>(R|<local>/computable|))
}
@@ -1091,6 +1091,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/problems/defaultJavaImportHiding.kt");
}
@TestMetadata("definetelyNotNullForTypeParameter.kt")
public void testDefinetelyNotNullForTypeParameter() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/definetelyNotNullForTypeParameter.kt");
}
@TestMetadata("definitelyNotNullAmbiguity.kt")
public void testDefinitelyNotNullAmbiguity() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/definitelyNotNullAmbiguity.kt");
@@ -1091,6 +1091,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/resolve/testData/resolve/problems/defaultJavaImportHiding.kt");
}
@TestMetadata("definetelyNotNullForTypeParameter.kt")
public void testDefinetelyNotNullForTypeParameter() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/definetelyNotNullForTypeParameter.kt");
}
@TestMetadata("definitelyNotNullAmbiguity.kt")
public void testDefinitelyNotNullAmbiguity() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/definitelyNotNullAmbiguity.kt");