FIR: Refine inference constraints when type variable in flexible position

That issue might be fixed via changing
TypeVariableMarker.shouldBeFlexible at ConeConstraintSystemUtilContext
but this and some other tricks have been added because of incorrect
handling of constraints where type variable has a flexible bound

^KT-51168 Fixed
This commit is contained in:
Denis.Zharkov
2022-04-12 16:30:55 +03:00
committed by teamcity
parent 853b7ec078
commit f70ae2df3a
54 changed files with 411 additions and 154 deletions
@@ -0,0 +1,36 @@
// FIR_IDENTICAL
// SKIP_TXT
// FILE: AbstractMapAssert.java
import java.util.Map;
public abstract class AbstractMapAssert<SELF extends AbstractMapAssert<SELF, ACTUAL, K, V>, ACTUAL extends Map<K, V>, K, V> {
public SELF isNotNull() {
return (SELF) this;
}
}
// FILE: MapAssert.java
import java.util.Map;
public class MapAssert<KEY, VALUE> extends AbstractMapAssert<MapAssert<KEY, VALUE>, Map<KEY, VALUE>, KEY, VALUE> {
public MapAssert(Map<KEY, VALUE> actual) {}
}
// FILE: Assertions.java
import java.util.Map;
public class Assertions {
public static <K, V> MapAssert<K, V> assertThat(Map<K, V> actual) {
return new MapAssert<>(actual);
}
}
// FILE: test.kt
fun <S : Map<*,*>> S?.must() {
Assertions.assertThat(this).isNotNull
}