Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/variables/propertyFromDependsOnModule.kt
T
Dmitry Savvinov 337330f8c8 [Tests] Add a test on smartcasts on properties from dependsOn modules
Behaviour is undesired, will be fixed in the next commit
2024-01-31 09:53:45 +00:00

34 lines
700 B
Kotlin
Vendored

// 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
}