[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:
Dmitry Savvinov
2024-01-25 18:46:45 +01:00
committed by Space Team
parent 74fa6fc12c
commit 337330f8c8
7 changed files with 96 additions and 0 deletions
@@ -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
}