Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/forks/nestedCallVariableFixationSimple.kt
T
Denis.Zharkov ca12cfb90d K2: Do not fix variables that has yet unprocessed constraints in forks
Otherwise, exception from org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintInjector.TypeCheckerStateForConstraintInjector.fixedTypeVariable
might happen during forks resolution

The test data is extracted from intelliJ FP test

^KT-43296 Fixed
2022-11-24 17:29:30 +00:00

18 lines
667 B
Kotlin
Vendored

// SKIP_TXT
interface Generic<K, V>
fun <X, Y> Generic<X, Y>.getValue(x: X): Y = TODO()
class MyPair<A, B>(a: A, b: B)
fun <E, F> foo(x: Generic<E, F>, e: E, c: Generic<Int, String>): MyPair<F, F> {
if (c === x && e is Int) {
bar(MyPair(<!DEBUG_INFO_SMARTCAST!>x<!>.getValue(<!DEBUG_INFO_SMARTCAST!>e<!>), <!DEBUG_INFO_SMARTCAST!>x<!>.getValue(<!DEBUG_INFO_SMARTCAST!>e<!>)))
return <!TYPE_MISMATCH!>MyPair(<!DEBUG_INFO_SMARTCAST!>x<!>.getValue(<!DEBUG_INFO_SMARTCAST!>e<!>), <!DEBUG_INFO_SMARTCAST!>x<!>.getValue(<!DEBUG_INFO_SMARTCAST!>e<!>))<!>
}
return MyPair(x.getValue(e), x.getValue(e))
}
fun bar(p: MyPair<String, String>) {}