[FIR] Disable data flow from in-place lambdas

There are many complications with the current design of passing data
from within in-place lambdas to surrounding code. Solving these
complications will involve more time to investigation than is available
within the K2 release. So we are disabling passing type statement
information from lambdas for the time being until more time can be
devoted to a more complete solution.

^KT-60958 Fixed
^KT-63530 Fixed
This commit is contained in:
Brian Norman
2023-12-11 10:25:48 -06:00
committed by Space Team
parent 645970fa7a
commit b2041e0927
68 changed files with 2834 additions and 2962 deletions
@@ -10,13 +10,13 @@ fun testSafeCaptureVarInInitializer() {
val s = when (val y = run { x = 42; 32 }) {
0 -> {
x.inc() // TODO fix smart casts for captured variables
x<!UNSAFE_CALL!>.<!>inc() // TODO fix smart casts for captured variables
"0"
}
else -> "!= 0"
}
x.inc() // TODO fix smart casts for captured variables
x<!UNSAFE_CALL!>.<!>inc() // TODO fix smart casts for captured variables
}
@@ -1,48 +0,0 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
fun foo(s1: Int, s2: Int) = s1 + s2
fun test1(x: String?) =
when (val y = x?.length) {
null -> 0
else -> foo(x.length, y)
}
fun test2(x: String?) {
when (val y = run { x!! }) {
"foo" -> x.length
"bar" -> y.length
}
}
fun test3(x: String?, y: String?) {
when (val z = x ?: y!!) {
"foo" -> x<!UNSAFE_CALL!>.<!>length
"bar" -> y<!UNSAFE_CALL!>.<!>length
"baz" -> z.length
}
}
fun <T> id(x: T): T = x
fun test4(x: String?) {
when (val y = id(x!!)) {
"foo" -> x.length
"bar" -> y.length
}
}
class Inv<T>(val data: T)
fun test5(x: Inv<out Any?>) {
when (val y = x.data) {
is String -> y.length // should be ok
null -> x.data.<!UNRESOLVED_REFERENCE!>length<!> // should be error
}
}
fun test6(x: Inv<out String?>) {
when (val y = x.data) {
is String -> x.data.length // should be ok
}
}
@@ -1,11 +1,13 @@
// FIR_IDENTICAL
// !LANGUAGE: +VariableDeclarationInWhenSubject
// DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
fun foo(s1: Int, s2: Int) = s1 + s2
fun test1(x: String?) =
when (val y = x?.length) {
null -> 0
else -> foo(<!DEBUG_INFO_SMARTCAST!>x<!>.length, <!DEBUG_INFO_SMARTCAST!>y<!>)
else -> foo(x.length, y)
}
fun test2(x: String?) {
@@ -27,7 +29,7 @@ fun <T> id(x: T): T = x
fun test4(x: String?) {
when (val y = id(x!!)) {
"foo" -> <!DEBUG_INFO_SMARTCAST!>x<!>.length
"foo" -> x.length
"bar" -> y.length
}
}
@@ -36,13 +38,13 @@ class Inv<T>(val data: T)
fun test5(x: Inv<out Any?>) {
when (val y = x.data) {
is String -> <!DEBUG_INFO_SMARTCAST!>y<!>.length // should be ok
is String -> y.length // should be ok
null -> x.data.<!UNRESOLVED_REFERENCE!>length<!> // should be error
}
}
fun test6(x: Inv<out String?>) {
when (val y = x.data) {
is String -> <!DEBUG_INFO_SMARTCAST!>x.data<!>.length // should be ok
is String -> x.data.length // should be ok
}
}