K1/K2: add test cases for KT-53792 and KT-66369
This commit is contained in:
committed by
Space Team
parent
09f384d96e
commit
c04a8fc3b8
+12
@@ -13332,6 +13332,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInParameter.kt")
|
||||||
|
public void testDnnTypeProjectionInParameter() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInReceiver.kt")
|
||||||
|
public void testDnnTypeProjectionInReceiver() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inference.kt")
|
@TestMetadata("inference.kt")
|
||||||
public void testInference() {
|
public void testInference() {
|
||||||
|
|||||||
+12
@@ -13332,6 +13332,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInParameter.kt")
|
||||||
|
public void testDnnTypeProjectionInParameter() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInReceiver.kt")
|
||||||
|
public void testDnnTypeProjectionInReceiver() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inference.kt")
|
@TestMetadata("inference.kt")
|
||||||
public void testInference() {
|
public void testInference() {
|
||||||
|
|||||||
+12
@@ -13326,6 +13326,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInParameter.kt")
|
||||||
|
public void testDnnTypeProjectionInParameter() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInReceiver.kt")
|
||||||
|
public void testDnnTypeProjectionInReceiver() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inference.kt")
|
@TestMetadata("inference.kt")
|
||||||
public void testInference() {
|
public void testInference() {
|
||||||
|
|||||||
+12
@@ -13332,6 +13332,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInParameter.kt")
|
||||||
|
public void testDnnTypeProjectionInParameter() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInReceiver.kt")
|
||||||
|
public void testDnnTypeProjectionInReceiver() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inference.kt")
|
@TestMetadata("inference.kt")
|
||||||
public void testInference() {
|
public void testInference() {
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
// ISSUE: KT-53792, KT-66369
|
||||||
|
|
||||||
|
class MyBoxInv<T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> getSizeInv(box: MyBoxInv<T & Any>) = box.value.length
|
||||||
|
|
||||||
|
class MyBoxOut<out T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> getSizeOut(box: MyBoxOut<T & Any>) = box.value.length
|
||||||
|
|
||||||
|
class MyBoxIn<in T : String?> {
|
||||||
|
fun foo(arg: T) {
|
||||||
|
arg.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : String?> foo(box: MyBoxIn<T & Any>, arg: T) {
|
||||||
|
box.foo(<!ARGUMENT_TYPE_MISMATCH!>arg<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val emptyBoxInv = MyBoxInv<String?>(null)
|
||||||
|
getSizeInv(<!ARGUMENT_TYPE_MISMATCH!>emptyBoxInv<!>)
|
||||||
|
|
||||||
|
val emptyBoxOut = MyBoxOut<String?>(null)
|
||||||
|
getSizeOut(<!ARGUMENT_TYPE_MISMATCH!>emptyBoxOut<!>)
|
||||||
|
|
||||||
|
val emptyBoxIn = MyBoxIn<String?>()
|
||||||
|
foo(emptyBoxIn, null)
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
// ISSUE: KT-53792, KT-66369
|
||||||
|
|
||||||
|
class MyBoxInv<T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> getSizeInv(box: MyBoxInv<T & Any>) = box.value.length
|
||||||
|
|
||||||
|
class MyBoxOut<out T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> getSizeOut(box: MyBoxOut<T & Any>) = box.value.length
|
||||||
|
|
||||||
|
class MyBoxIn<in T : String?> {
|
||||||
|
fun foo(arg: T) {
|
||||||
|
arg.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : String?> foo(box: MyBoxIn<T & Any>, arg: T) {
|
||||||
|
box.foo(<!TYPE_MISMATCH!>arg<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val emptyBoxInv = MyBoxInv<String?>(null)
|
||||||
|
getSizeInv(<!TYPE_MISMATCH!>emptyBoxInv<!>)
|
||||||
|
|
||||||
|
val emptyBoxOut = MyBoxOut<String?>(null)
|
||||||
|
getSizeOut(<!TYPE_MISMATCH!>emptyBoxOut<!>)
|
||||||
|
|
||||||
|
val emptyBoxIn = MyBoxIn<String?>()
|
||||||
|
foo(emptyBoxIn, null)
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
// ISSUE: KT-53792, KT-66369
|
||||||
|
|
||||||
|
class MyBoxInv<T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> MyBoxInv<T & Any>.getSizeInv() = value.length
|
||||||
|
|
||||||
|
class MyBoxOut<out T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> MyBoxOut<T & Any>.getSizeOut() = value.length
|
||||||
|
|
||||||
|
class MyBoxIn<in T : String?> {
|
||||||
|
fun foo(arg: T) {
|
||||||
|
arg.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : String?> MyBoxIn<T & Any>.fooExt(arg: T) {
|
||||||
|
foo(<!ARGUMENT_TYPE_MISMATCH!>arg<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val emptyBoxInv = MyBoxInv<String?>(null)
|
||||||
|
emptyBoxInv.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>getSizeInv<!>()
|
||||||
|
|
||||||
|
val emptyBoxOut = MyBoxOut<String?>(null)
|
||||||
|
emptyBoxOut.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>getSizeOut<!>()
|
||||||
|
|
||||||
|
val emptyBoxIn = MyBoxIn<String?>()
|
||||||
|
emptyBoxIn.fooExt(null)
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
// ISSUE: KT-53792, KT-66369
|
||||||
|
|
||||||
|
class MyBoxInv<T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> MyBoxInv<T & Any>.getSizeInv() = value.length
|
||||||
|
|
||||||
|
class MyBoxOut<out T : String?>(val value: T)
|
||||||
|
|
||||||
|
fun <T : String?> MyBoxOut<T & Any>.getSizeOut() = value.length
|
||||||
|
|
||||||
|
class MyBoxIn<in T : String?> {
|
||||||
|
fun foo(arg: T) {
|
||||||
|
arg.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : String?> MyBoxIn<T & Any>.fooExt(arg: T) {
|
||||||
|
foo(<!TYPE_MISMATCH!>arg<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val emptyBoxInv = MyBoxInv<String?>(null)
|
||||||
|
emptyBoxInv.getSizeInv()
|
||||||
|
|
||||||
|
val emptyBoxOut = MyBoxOut<String?>(null)
|
||||||
|
emptyBoxOut.getSizeOut()
|
||||||
|
|
||||||
|
val emptyBoxIn = MyBoxIn<String?>()
|
||||||
|
emptyBoxIn.fooExt(null)
|
||||||
|
}
|
||||||
Generated
+12
@@ -13332,6 +13332,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInParameter.kt")
|
||||||
|
public void testDnnTypeProjectionInParameter() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("dnnTypeProjectionInReceiver.kt")
|
||||||
|
public void testDnnTypeProjectionInReceiver() {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/dnnTypeProjectionInReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inference.kt")
|
@TestMetadata("inference.kt")
|
||||||
public void testInference() {
|
public void testInference() {
|
||||||
|
|||||||
Reference in New Issue
Block a user