FE: add one more test related to KT-56511 with the relevant feature ON

This commit is contained in:
Mikhail Glukhikh
2023-03-14 10:15:37 +01:00
committed by Space Team
parent 41c868445c
commit e8232a7572
8 changed files with 66 additions and 15 deletions
@@ -30181,9 +30181,15 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClass.kt");
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClassForbidden.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClassForbidden() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClassForbidden.kt");
}
@Test
@@ -30181,9 +30181,15 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClass.kt");
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClassForbidden.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClassForbidden() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClassForbidden.kt");
}
@Test
@@ -30277,9 +30277,15 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClass.kt");
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClassForbidden.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClassForbidden() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClassForbidden.kt");
}
@Test
@@ -1,10 +1,10 @@
// -- Module: <m1> --
// -- Module: <m2> --
/B.kt:13:13: warning: smart cast to 'String' is deprecated, because 'x' is a property declared in base class from different module inherited in non-public API class
/B.kt:14:13: warning: smart cast to 'String' is deprecated, because 'x' is a property declared in base class from different module inherited in non-public API class
x.length
^
/B.kt:22:9: warning: smart cast to 'String' is deprecated, because 'i.x' is a property declared in base class from different module inherited in non-public API class
/B.kt:23:9: warning: smart cast to 'String' is deprecated, because 'i.x' is a property declared in base class from different module inherited in non-public API class
i.x.length
^
@@ -1,3 +1,4 @@
// !LANGUAGE: -ProhibitSmartcastsOnPropertyFromAlienBaseClassInheritedInInvisibleClass
// RENDER_DIAGNOSTICS_FULL_TEXT
// MODULE: m1
// FILE: A.kt
@@ -19,6 +20,6 @@ internal class Internal : Base("456")
internal fun bar(i: Internal) {
if (i.x is String) {
i.x.length
<!SMARTCAST_IMPOSSIBLE!>i.x<!>.length
}
}
@@ -1,3 +1,4 @@
// !LANGUAGE: -ProhibitSmartcastsOnPropertyFromAlienBaseClassInheritedInInvisibleClass
// RENDER_DIAGNOSTICS_FULL_TEXT
// MODULE: m1
// FILE: A.kt
@@ -0,0 +1,25 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitSmartcastsOnPropertyFromAlienBaseClassInheritedInInvisibleClass
// MODULE: m1
// FILE: A.kt
open class Base(val x: Any)
// MODULE: m2(m1)
// FILE: B.kt
private class Derived : Base("123") {
fun foo() {
if (x is String) {
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
}
}
}
internal class Internal : Base("456")
internal fun bar(i: Internal) {
if (i.x is String) {
<!SMARTCAST_IMPOSSIBLE!>i.x<!>.length
}
}
@@ -30277,9 +30277,15 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClass.kt");
}
@Test
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClassForbidden.kt")
public void testSmartCastOnAlienPropertyFromInvisibleClassForbidden() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInvisibleClassForbidden.kt");
}
@Test