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
This commit is contained in:
Denis.Zharkov
2022-11-02 18:51:20 +01:00
committed by Space Team
parent b73acd7a3a
commit ca12cfb90d
8 changed files with 122 additions and 2 deletions
@@ -0,0 +1,17 @@
// 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(x.getValue(e), x.getValue(e)))
return MyPair(x.getValue(e), x.getValue(e))
}
return MyPair(x.getValue(e), x.getValue(e))
}
fun bar(p: MyPair<String, String>) {}