From 6481bb658fdc034beee5fd698525d0b51ab1f027 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 17 May 2013 13:33:03 +0400 Subject: [PATCH] Do not skip names of error classes --- .../jetbrains/jet/lang/types/ErrorUtils.java | 21 +++++++++++++++++-- .../jet/renderer/DescriptorRendererImpl.java | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java index e5d069264d7..1410cbfa734 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java @@ -268,6 +268,19 @@ public class ErrorUtils { } }; + private static final class ErrorTypeConstructor extends TypeConstructorImpl { + private ErrorTypeConstructor( + @Nullable ClassifierDescriptor classifierDescriptor, + @NotNull List annotations, + boolean sealed, + @NotNull String debugName, + @NotNull List parameters, + @NotNull Collection supertypes + ) { + super(classifierDescriptor, annotations, sealed, debugName, parameters, supertypes); + } + } + private static final Set ERROR_CONSTRUCTOR_GROUP = Collections.singleton(createErrorConstructor(0, Collections.emptyList())); private static final ConstructorDescriptor ERROR_CONSTRUCTOR = new ConstructorDescriptorImpl(ERROR_CLASS, Collections.emptyList(), true); @@ -359,7 +372,11 @@ public class ErrorUtils { } private static JetType createErrorTypeWithCustomDebugName(JetScope memberScope, String debugName) { - return new ErrorTypeImpl(new TypeConstructorImpl(ERROR_CLASS, Collections.emptyList(), false, debugName, Collections.emptyList(), Collections.singleton(KotlinBuiltIns.getInstance().getAnyType())), memberScope); + TypeConstructorImpl constructor = + new ErrorTypeConstructor(ERROR_CLASS, Collections.emptyList(), false, debugName, + Collections.emptyList(), + Collections.singleton(KotlinBuiltIns.getInstance().getAnyType())); + return new ErrorTypeImpl(constructor, memberScope); } public static JetType createWrongVarianceErrorType(TypeProjection value) { @@ -371,7 +388,7 @@ public class ErrorUtils { } public static boolean isError(@NotNull TypeConstructor typeConstructor) { - return typeConstructor == ERROR_CLASS.getTypeConstructor(); + return typeConstructor == ERROR_CLASS.getTypeConstructor() || typeConstructor instanceof ErrorTypeConstructor; } public static boolean isErrorType(@NotNull JetType type) { diff --git a/compiler/frontend/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java b/compiler/frontend/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java index 66e319058d5..667a423030e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java @@ -182,6 +182,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer { @NotNull private String renderClassName(@NotNull ClassDescriptor klass) { + if (ErrorUtils.isError(klass)) { + return klass.getTypeConstructor().toString(); + } if (shortNames) { List qualifiedNameElements = Lists.newArrayList();