[Tests] Add a test on smartcasts on properties from dependsOn modules
Behaviour is undesired, will be fixed in the next commit
This commit is contained in:
committed by
Space Team
parent
74fa6fc12c
commit
337330f8c8
+6
@@ -36891,6 +36891,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/property.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyFromDependsOnModule.kt")
|
||||
public void testPropertyFromDependsOnModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertyFromDependsOnModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyNotNeeded.kt")
|
||||
public void testPropertyNotNeeded() throws Exception {
|
||||
|
||||
+6
@@ -36891,6 +36891,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/property.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyFromDependsOnModule.kt")
|
||||
public void testPropertyFromDependsOnModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertyFromDependsOnModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyNotNeeded.kt")
|
||||
public void testPropertyNotNeeded() throws Exception {
|
||||
|
||||
+6
@@ -34535,6 +34535,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/property.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyFromDependsOnModule.kt")
|
||||
public void testPropertyFromDependsOnModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertyFromDependsOnModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyNotNeeded.kt")
|
||||
public void testPropertyNotNeeded() throws Exception {
|
||||
|
||||
+6
@@ -34661,6 +34661,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/property.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyFromDependsOnModule.kt")
|
||||
public void testPropertyFromDependsOnModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertyFromDependsOnModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyNotNeeded.kt")
|
||||
public void testPropertyNotNeeded() throws Exception {
|
||||
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// SKIP_TXT
|
||||
|
||||
// MODULE: transitive
|
||||
// FILE: Transitive.kt
|
||||
class Transitive {
|
||||
val finalProperty: Any = "";
|
||||
}
|
||||
|
||||
|
||||
// MODULE: direct()()(transitive)
|
||||
// FILE: Direct.kt
|
||||
class Direct {
|
||||
val finalProperty: Any = "";
|
||||
}
|
||||
|
||||
// MODULE: app()()(direct)
|
||||
fun isCast(d: Direct, t: Transitive) {
|
||||
if (d.finalProperty is String) {
|
||||
d.finalProperty.length
|
||||
}
|
||||
|
||||
if (t.finalProperty is String) {
|
||||
<!SMARTCAST_IMPOSSIBLE!>t.finalProperty<!>.length
|
||||
}
|
||||
}
|
||||
|
||||
fun asCast(d: Direct, t: Transitive) {
|
||||
d.finalProperty as String
|
||||
d.finalProperty.length
|
||||
|
||||
t.finalProperty as String
|
||||
<!SMARTCAST_IMPOSSIBLE!>t.finalProperty<!>.length
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// SKIP_TXT
|
||||
|
||||
// MODULE: transitive
|
||||
// FILE: Transitive.kt
|
||||
class Transitive {
|
||||
val finalProperty: Any = "";
|
||||
}
|
||||
|
||||
|
||||
// MODULE: direct()()(transitive)
|
||||
// FILE: Direct.kt
|
||||
class Direct {
|
||||
val finalProperty: Any = "";
|
||||
}
|
||||
|
||||
// MODULE: app()()(direct)
|
||||
fun isCast(d: Direct, t: Transitive) {
|
||||
if (d.finalProperty is String) {
|
||||
<!DEBUG_INFO_SMARTCAST!>d.finalProperty<!>.length
|
||||
}
|
||||
|
||||
if (t.finalProperty is String) {
|
||||
<!DEBUG_INFO_SMARTCAST!>t.finalProperty<!>.length
|
||||
}
|
||||
}
|
||||
|
||||
fun asCast(d: Direct, t: Transitive) {
|
||||
d.finalProperty as String
|
||||
<!DEBUG_INFO_SMARTCAST!>d.finalProperty<!>.length
|
||||
|
||||
t.finalProperty as String
|
||||
<!DEBUG_INFO_SMARTCAST!>t.finalProperty<!>.length
|
||||
}
|
||||
Generated
+6
@@ -36891,6 +36891,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/property.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyFromDependsOnModule.kt")
|
||||
public void testPropertyFromDependsOnModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertyFromDependsOnModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyNotNeeded.kt")
|
||||
public void testPropertyNotNeeded() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user