Assert no lookup in meaningless scope created by commonSupertype()

This commit is contained in:
Andrey Breslav
2015-02-13 19:42:57 +01:00
parent c61a29d4f5
commit 47f772e75a
@@ -223,14 +223,17 @@ public class CommonSupertypes {
nullable |= type.isMarkedNullable();
}
JetScope newScope = JetScope.Empty.INSTANCE$;
ClassifierDescriptor declarationDescriptor = constructor.getDeclarationDescriptor();
JetScope newScope;
if (declarationDescriptor instanceof ClassDescriptor) {
newScope = ((ClassDescriptor) declarationDescriptor).getMemberScope(newProjections);
}
else if (declarationDescriptor instanceof TypeParameterDescriptor) {
newScope = ((TypeParameterDescriptor) declarationDescriptor).getUpperBoundsAsType().getMemberScope();
}
else {
newScope = ErrorUtils.createErrorScope("A scope for common supertype which is not a normal classifier", true);
}
return new JetTypeImpl(Annotations.EMPTY, constructor, nullable, newProjections, newScope);
}