FINAL_UPPER_BOUNDS checked for classes in LAZY mode
This commit is contained in:
@@ -146,10 +146,12 @@ public class DeclarationsChecker {
|
||||
|
||||
for (JetTypeParameter jetTypeParameter : jetClass.getTypeParameters()) {
|
||||
checkBoundsForTypeInClassHeader(jetTypeParameter.getExtendsBound());
|
||||
checkFinalUpperBounds(jetTypeParameter.getExtendsBound(), false);
|
||||
}
|
||||
|
||||
for (JetTypeConstraint constraint : jetClass.getTypeConstraints()) {
|
||||
checkBoundsForTypeInClassHeader(constraint.getBoundTypeReference());
|
||||
checkFinalUpperBounds(constraint.getBoundTypeReference(), constraint.isClassObjectConstraint());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,6 +164,15 @@ public class DeclarationsChecker {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkFinalUpperBounds(@Nullable JetTypeReference typeReference, boolean isClassObjectConstraint) {
|
||||
if (typeReference != null) {
|
||||
JetType type = trace.getBindingContext().get(TYPE, typeReference);
|
||||
if (type != null) {
|
||||
DescriptorResolver.checkUpperBoundType(typeReference, type, isClassObjectConstraint, trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSupertypesForConsistency(@NotNull ClassDescriptor classDescriptor) {
|
||||
Multimap<TypeConstructor, TypeProjection> multimap = SubstitutionUtils
|
||||
.buildDeepSubstitutionMultimap(classDescriptor.getDefaultType());
|
||||
|
||||
@@ -701,11 +701,11 @@ public class DescriptorResolver {
|
||||
}
|
||||
}
|
||||
|
||||
for (UpperBoundCheckerTask checkerTask : deferredUpperBoundCheckerTasks) {
|
||||
checkUpperBoundType(checkerTask.upperBound, checkerTask.upperBoundType, checkerTask.isClassObjectConstraint, trace);
|
||||
}
|
||||
|
||||
if (!(declaration instanceof JetClass)) {
|
||||
for (UpperBoundCheckerTask checkerTask : deferredUpperBoundCheckerTasks) {
|
||||
checkUpperBoundType(checkerTask.upperBound, checkerTask.upperBoundType, checkerTask.isClassObjectConstraint, trace);
|
||||
}
|
||||
|
||||
checkNamesInConstraints(declaration, descriptor, scope, trace);
|
||||
}
|
||||
}
|
||||
@@ -747,7 +747,7 @@ public class DescriptorResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkUpperBoundType(
|
||||
public static void checkUpperBoundType(
|
||||
JetTypeReference upperBound,
|
||||
JetType upperBoundType,
|
||||
boolean isClassObjectConstraint,
|
||||
|
||||
Reference in New Issue
Block a user