map intersection type to its common supertype

This commit is contained in:
Dmitry Jemerov
2012-05-24 17:58:00 +02:00
parent fb5fd47591
commit 2f32e9c60d
@@ -376,8 +376,16 @@ public class JetTypeMapper {
}
}
final TypeConstructor constructor = jetType.getConstructor();
if (constructor instanceof IntersectionTypeConstructor) {
jetType = CommonSupertypes.commonSupertype(new ArrayList<JetType>(constructor.getSupertypes()));
}
DeclarationDescriptor descriptor = jetType.getConstructor().getDeclarationDescriptor();
if (descriptor == null) {
throw new UnsupportedOperationException("no descriptor for type constructor of " + jetType);
}
if (ErrorUtils.isError(descriptor)) {
if (classBuilderMode != ClassBuilderMode.SIGNATURES) {
throw new IllegalStateException("error types are not allowed when classBuilderMode = " + classBuilderMode);