[FIR] Remove all usages of classes and methods from FE 1.0 from FIR checkers

This commit is contained in:
Dmitriy Novozhilov
2021-09-09 10:16:58 +03:00
committed by TeamCityServer
parent 0260bf8767
commit 15b77045ee
8 changed files with 90 additions and 60 deletions
@@ -126,23 +126,6 @@ public class TypeCheckingProcedure {
&& isSubtypeOf(inflexibleType, FlexibleTypesKt.asFlexibleType(flexibleType).getUpperBound());
}
public enum EnrichedProjectionKind {
IN, OUT, INV, STAR;
@NotNull
public static EnrichedProjectionKind fromVariance(@NotNull Variance variance) {
switch (variance) {
case INVARIANT:
return INV;
case IN_VARIANCE:
return IN;
case OUT_VARIANCE:
return OUT;
}
throw new IllegalStateException("Unknown variance");
}
}
public static EnrichedProjectionKind getEffectiveProjectionKind(
@NotNull TypeParameterDescriptor typeParameter,
@NotNull TypeProjection typeArgument
@@ -166,26 +149,7 @@ public class TypeCheckingProcedure {
@NotNull Variance typeParameterVariance,
@NotNull Variance typeArgumentVariance
) {
Variance a = typeParameterVariance;
Variance b = typeArgumentVariance;
// If they are not both invariant, let's make b not invariant for sure
if (b == INVARIANT) {
Variance t = a;
a = b;
b = t;
}
// Opposites yield STAR
if (a == IN_VARIANCE && b == OUT_VARIANCE) {
return EnrichedProjectionKind.STAR;
}
if (a == OUT_VARIANCE && b == IN_VARIANCE) {
return EnrichedProjectionKind.STAR;
}
// If they are not opposite, return b, because b is either equal to a or b is in/out and a is inv
return EnrichedProjectionKind.fromVariance(b);
return EnrichedProjectionKind.Companion.getEffectiveProjectionKind(typeParameterVariance, typeArgumentVariance);
}
public boolean isSubtypeOf(@NotNull KotlinType subtype, @NotNull KotlinType supertype) {