Make getUpperBoundsAsType an utility, remove from TypeParameterDescriptor
This commit is contained in:
+10
-8
@@ -32,14 +32,13 @@ import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaResolverUtils;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.Variance;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.kotlin.load.java.components.TypeUsage.MEMBER_SIGNATURE_CONTRAVARIANT;
|
||||
import static org.jetbrains.kotlin.load.java.components.TypeUsage.UPPER_BOUND;
|
||||
@@ -140,13 +139,16 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
||||
for (TypeParameterDescriptor parameter : methodTypeParameters) {
|
||||
int index = parameter.getIndex();
|
||||
|
||||
KotlinType substituted = substitutor.substitute(parameter.getUpperBoundsAsType(), Variance.INVARIANT);
|
||||
KotlinType upperBoundsAsType = TypeIntersector.getUpperBoundsAsType(parameter);
|
||||
KotlinType substituted = substitutor.substitute(upperBoundsAsType, Variance.INVARIANT);
|
||||
assert substituted != null;
|
||||
|
||||
if (!TypeUtils.equalTypes(substituted, altTypeParameters.get(index).getUpperBoundsAsType())) {
|
||||
KotlinType altUpperBoundsAsType = TypeIntersector.getUpperBoundsAsType(altTypeParameters.get(index));
|
||||
if (!TypeUtils.equalTypes(substituted, altUpperBoundsAsType)) {
|
||||
throw new AlternativeSignatureMismatchException(
|
||||
"Type parameter's upper bound changed for method which overrides another: "
|
||||
+ altTypeParameters.get(index).getUpperBoundsAsType() + ", was: " + parameter.getUpperBoundsAsType());
|
||||
+ altUpperBoundsAsType + ", was: " + upperBoundsAsType
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ public class TypeTransformingVisitor extends KtVisitor<KotlinType, Void> {
|
||||
|
||||
KtScope memberScope;
|
||||
if (typeConstructorClassifier instanceof TypeParameterDescriptor) {
|
||||
memberScope = ((TypeParameterDescriptor) typeConstructorClassifier).getUpperBoundsAsType().getMemberScope();
|
||||
memberScope = typeConstructorClassifier.getDefaultType().getMemberScope();
|
||||
}
|
||||
else if (typeConstructorClassifier instanceof ClassDescriptor) {
|
||||
memberScope = ((ClassDescriptor) typeConstructorClassifier).getMemberScope(altArguments);
|
||||
|
||||
Reference in New Issue
Block a user