FE: add one more test related to KT-56511 with the relevant feature ON
This commit is contained in:
committed by
Space Team
parent
41c868445c
commit
e8232a7572
+9
-3
@@ -30181,9 +30181,15 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
|
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
|
||||||
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
|
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
|
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
|
@Test
|
||||||
|
|||||||
+9
-3
@@ -30181,9 +30181,15 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
|
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
|
||||||
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
|
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
|
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
|
@Test
|
||||||
|
|||||||
+9
-3
@@ -30277,9 +30277,15 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
|
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
|
||||||
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
|
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
|
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
|
@Test
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
// -- Module: <m1> --
|
// -- Module: <m1> --
|
||||||
|
|
||||||
// -- Module: <m2> --
|
// -- 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
|
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
|
i.x.length
|
||||||
^
|
^
|
||||||
|
|
||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: -ProhibitSmartcastsOnPropertyFromAlienBaseClassInheritedInInvisibleClass
|
||||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
// RENDER_DIAGNOSTICS_FULL_TEXT
|
||||||
// MODULE: m1
|
// MODULE: m1
|
||||||
// FILE: A.kt
|
// FILE: A.kt
|
||||||
@@ -19,6 +20,6 @@ internal class Internal : Base("456")
|
|||||||
|
|
||||||
internal fun bar(i: Internal) {
|
internal fun bar(i: Internal) {
|
||||||
if (i.x is String) {
|
if (i.x is String) {
|
||||||
i.x.length
|
<!SMARTCAST_IMPOSSIBLE!>i.x<!>.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: -ProhibitSmartcastsOnPropertyFromAlienBaseClassInheritedInInvisibleClass
|
||||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
// RENDER_DIAGNOSTICS_FULL_TEXT
|
||||||
// MODULE: m1
|
// MODULE: m1
|
||||||
// FILE: A.kt
|
// FILE: A.kt
|
||||||
+25
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+9
-3
@@ -30277,9 +30277,15 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("smartCastOnAlienPropertyFromInnerClass.kt")
|
@TestMetadata("smartCastOnAlienPropertyFromInvisibleClass.kt")
|
||||||
public void testSmartCastOnAlienPropertyFromInnerClass() throws Exception {
|
public void testSmartCastOnAlienPropertyFromInvisibleClass() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/smartCasts/smartCastOnAlienPropertyFromInnerClass.kt");
|
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
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user