[FIR] Improve approximation of captured types

- Handle flexible types in recursion check
- Handle intersected supertypes separately
- Make check when not to approximate captured types in type argument
  position more fine-grained.
  Only apply it to case when the captured type is replaced by a star
  projection.
  All other cases are handled by recursive calls to
  approximateCapturedType

#KT-65377 Fixed
This commit is contained in:
Kirill Rakhman
2024-02-08 12:20:43 +01:00
committed by Space Team
parent 831ef0f909
commit b90598823e
8 changed files with 95 additions and 46 deletions
@@ -0,0 +1,23 @@
// FIR_IDENTICAL
// DIAGNOSTICS: -UNUSED_PARAMETER
interface A<V>
fun interface F<O> {
fun apply(): A<O>
}
object C {
fun <V> createA(): A<V> = TODO()
}
class B<V> {
fun bar(function: F<out V>): B<V> = TODO()
companion object {
fun <X> from(a: A<X>): B<X> = TODO()
}
}
fun foo(a: A<*>) {
B.from(a).bar { C.createA() }
}