Delete ErrorUtils.isError(TypeConstructor)
This commit is contained in:
+2
-1
@@ -259,7 +259,8 @@ public class TypeDeserializer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isError() {
|
public boolean isError() {
|
||||||
return ErrorUtils.isError(getConstructor());
|
ClassifierDescriptor descriptor = getConstructor().getDeclarationDescriptor();
|
||||||
|
return descriptor != null && ErrorUtils.isError(descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ public class BodyResolver {
|
|||||||
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
||||||
if (classDescriptor == null) return;
|
if (classDescriptor == null) return;
|
||||||
if (descriptor.getKind() != ClassKind.TRAIT && !classDescriptor.getConstructors().isEmpty() &&
|
if (descriptor.getKind() != ClassKind.TRAIT && !classDescriptor.getConstructors().isEmpty() &&
|
||||||
!ErrorUtils.isError(classDescriptor.getTypeConstructor()) && classDescriptor.getKind() != ClassKind.TRAIT) {
|
!ErrorUtils.isError(classDescriptor) && classDescriptor.getKind() != ClassKind.TRAIT) {
|
||||||
trace.report(SUPERTYPE_NOT_INITIALIZED.on(specifier));
|
trace.report(SUPERTYPE_NOT_INITIALIZED.on(specifier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public class TypeResolver {
|
|||||||
List<TypeParameterDescriptor> parameters = typeConstructor.getParameters();
|
List<TypeParameterDescriptor> parameters = typeConstructor.getParameters();
|
||||||
int expectedArgumentCount = parameters.size();
|
int expectedArgumentCount = parameters.size();
|
||||||
int actualArgumentCount = arguments.size();
|
int actualArgumentCount = arguments.size();
|
||||||
if (ErrorUtils.isError(typeConstructor)) {
|
if (ErrorUtils.isError(classDescriptor)) {
|
||||||
result[0] = type(ErrorUtils.createErrorType("[Error type: " + typeConstructor + "]"));
|
result[0] = type(ErrorUtils.createErrorType("[Error type: " + typeConstructor + "]"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+2
-3
@@ -72,9 +72,8 @@ public class CallableDescriptorCollectors {
|
|||||||
|
|
||||||
private static void addConstructors(JetScope scope, Name name, Collection<FunctionDescriptor> functions) {
|
private static void addConstructors(JetScope scope, Name name, Collection<FunctionDescriptor> functions) {
|
||||||
ClassifierDescriptor classifier = scope.getClassifier(name);
|
ClassifierDescriptor classifier = scope.getClassifier(name);
|
||||||
if (classifier instanceof ClassDescriptor && !ErrorUtils.isError(classifier.getTypeConstructor())) {
|
if (classifier instanceof ClassDescriptor && !ErrorUtils.isError(classifier)) {
|
||||||
ClassDescriptor classDescriptor = (ClassDescriptor) classifier;
|
functions.addAll(((ClassDescriptor) classifier).getConstructors());
|
||||||
functions.addAll(classDescriptor.getConstructors());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,19 +255,6 @@ public class ErrorUtils {
|
|||||||
|
|
||||||
private static final ErrorClassDescriptor ERROR_CLASS = new ErrorClassDescriptor("");
|
private static final ErrorClassDescriptor ERROR_CLASS = new ErrorClassDescriptor("");
|
||||||
|
|
||||||
private static final class ErrorTypeConstructor extends TypeConstructorImpl {
|
|
||||||
private ErrorTypeConstructor(
|
|
||||||
@Nullable ClassifierDescriptor classifierDescriptor,
|
|
||||||
@NotNull List<AnnotationDescriptor> annotations,
|
|
||||||
boolean sealed,
|
|
||||||
@NotNull String debugName,
|
|
||||||
@NotNull List<? extends TypeParameterDescriptor> parameters,
|
|
||||||
@NotNull Collection<JetType> supertypes
|
|
||||||
) {
|
|
||||||
super(classifierDescriptor, annotations, sealed, debugName, parameters, supertypes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Set<ConstructorDescriptor> ERROR_CONSTRUCTOR_GROUP = Collections.singleton(createErrorConstructor());
|
private static final Set<ConstructorDescriptor> ERROR_CONSTRUCTOR_GROUP = Collections.singleton(createErrorConstructor());
|
||||||
|
|
||||||
private static final ConstructorDescriptor ERROR_CONSTRUCTOR = new ConstructorDescriptorImpl(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), true);
|
private static final ConstructorDescriptor ERROR_CONSTRUCTOR = new ConstructorDescriptorImpl(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), true);
|
||||||
@@ -343,21 +330,24 @@ public class ErrorUtils {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetType createErrorType(@NotNull String debugMessage) {
|
public static JetType createErrorType(@NotNull String debugMessage) {
|
||||||
return createErrorTypeWithCustomDebugName(createErrorScope(debugMessage), "[ERROR : " + debugMessage + "]");
|
return new ErrorTypeImpl(createErrorTypeConstructor(debugMessage), createErrorScope(debugMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetType createErrorTypeWithCustomDebugName(@NotNull String debugName) {
|
public static JetType createErrorTypeWithCustomDebugName(@NotNull String debugName) {
|
||||||
return createErrorTypeWithCustomDebugName(createErrorScope(debugName), debugName);
|
return new ErrorTypeImpl(createErrorTypeConstructorWithCustomDebugName(debugName), createErrorScope(debugName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static JetType createErrorTypeWithCustomDebugName(@NotNull JetScope memberScope, @NotNull String debugName) {
|
public static TypeConstructor createErrorTypeConstructor(@NotNull String debugMessage) {
|
||||||
TypeConstructorImpl constructor =
|
return createErrorTypeConstructorWithCustomDebugName("[ERROR : " + debugMessage + "]");
|
||||||
new ErrorTypeConstructor(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), false, debugName,
|
}
|
||||||
Collections.<TypeParameterDescriptorImpl>emptyList(),
|
|
||||||
Collections.singleton(KotlinBuiltIns.getInstance().getAnyType()));
|
@NotNull
|
||||||
return new ErrorTypeImpl(constructor, memberScope);
|
private static TypeConstructor createErrorTypeConstructorWithCustomDebugName(@NotNull String debugName) {
|
||||||
|
return new TypeConstructorImpl(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), false, debugName,
|
||||||
|
Collections.<TypeParameterDescriptorImpl>emptyList(),
|
||||||
|
Collections.singleton(KotlinBuiltIns.getInstance().getAnyType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -365,10 +355,6 @@ public class ErrorUtils {
|
|||||||
return ERROR_CLASS;
|
return ERROR_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isError(@NotNull TypeConstructor typeConstructor) {
|
|
||||||
return typeConstructor == ERROR_CLASS.getTypeConstructor() || typeConstructor instanceof ErrorTypeConstructor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean containsErrorType(@Nullable JetType type) {
|
public static boolean containsErrorType(@Nullable JetType type) {
|
||||||
if (type == null) return false;
|
if (type == null) return false;
|
||||||
if (type instanceof NamespaceType) return false;
|
if (type instanceof NamespaceType) return false;
|
||||||
|
|||||||
@@ -359,14 +359,10 @@ public class TypeUtils {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetType makeUnsubstitutedType(ClassDescriptor classDescriptor, JetScope unsubstitutedMemberScope) {
|
public static JetType makeUnsubstitutedType(ClassDescriptor classDescriptor, JetScope unsubstitutedMemberScope) {
|
||||||
return makeUnsubstitutedType(classDescriptor.getTypeConstructor(), unsubstitutedMemberScope);
|
if (ErrorUtils.isError(classDescriptor)) {
|
||||||
}
|
return ErrorUtils.createErrorType("Unsubstituted type for " + classDescriptor);
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static JetType makeUnsubstitutedType(TypeConstructor typeConstructor, JetScope unsubstitutedMemberScope) {
|
|
||||||
if (ErrorUtils.isError(typeConstructor)) {
|
|
||||||
return ErrorUtils.createErrorType("Unsubstituted type for " + typeConstructor);
|
|
||||||
}
|
}
|
||||||
|
TypeConstructor typeConstructor = classDescriptor.getTypeConstructor();
|
||||||
List<TypeProjection> arguments = getDefaultTypeProjections(typeConstructor.getParameters());
|
List<TypeProjection> arguments = getDefaultTypeProjections(typeConstructor.getParameters());
|
||||||
return new JetTypeImpl(
|
return new JetTypeImpl(
|
||||||
Collections.<AnnotationDescriptor>emptyList(),
|
Collections.<AnnotationDescriptor>emptyList(),
|
||||||
|
|||||||
Reference in New Issue
Block a user