[FIR] Properly handle flexible types during creation of DNNT

^KT-50788 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-01-14 16:49:38 +03:00
parent be020c588c
commit 57346bac54
8 changed files with 46 additions and 4 deletions
@@ -0,0 +1,5 @@
FILE: main.kt
public final fun <T : R|kotlin/CharSequence?|> foo(mapper: R|Mapper|, cls: R|java/lang/Class<T>?|): R|kotlin/Unit| {
lval result: R|T & Any| = R|<local>/mapper|.R|/Mapper.readValue|<R|ft<T, T?>|>(R|<local>/cls|)!!
R|<local>/result|.R|kotlin/CharSequence.length|
}
@@ -0,0 +1,14 @@
// ISSUE: KT-50788
// FILE: Mapper.java
public class Mapper {
public <T> T readValue(Class<T> valueType) {
return null;
}
}
// FILE: main.kt
fun <T : CharSequence?> foo(mapper: Mapper, cls: Class<T>?) {
val result = <!DEBUG_INFO_EXPRESSION_TYPE("T!!")!>mapper.readValue<T>(cls)!!<!> // The type of result is expected to be T & Any here, but in fact it's just T
result.length
}