Revert "Using default renderer in LoadBuiltinsTest."
This reverts commit 1d21ebf882.
Conflicts:
compiler/testData/builtin-classes.txt
core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java
Reverting a part of this (related to the field 'prettyFunctionTypes') because
will need to add a test that deserialized built-ins (obtained by
KotlinBuiltIns.getInstance()) are consistent with lazy resolved built-ins. This
test would break because while DescriptorRenderer renders pretty function types
it compares descriptors to the ones from KotlinBuiltIns, but in case of lazy
resolve descriptors created for built-ins would be different from
KotlinBuiltIns, so renderer wouldn't correctly render a function type
This commit is contained in:
@@ -35,6 +35,7 @@ public class DescriptorRendererBuilder {
|
||||
private boolean unitReturnType = true;
|
||||
private boolean normalizedVisibilities = false;
|
||||
private boolean showInternalKeyword = true;
|
||||
private boolean prettyFunctionTypes = true;
|
||||
@NotNull
|
||||
private DescriptorRenderer.OverrideRenderingPolicy overrideRenderingPolicy = DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN;
|
||||
@NotNull
|
||||
@@ -121,9 +122,14 @@ public class DescriptorRendererBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptorRendererBuilder setPrettyFunctionTypes(boolean prettyFunctionTypes) {
|
||||
this.prettyFunctionTypes = prettyFunctionTypes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptorRenderer build() {
|
||||
return new DescriptorRendererImpl(shortNames, withDefinedIn, modifiers, startFromName, debugMode, classWithPrimaryConstructor,
|
||||
verbose, unitReturnType, normalizedVisibilities, showInternalKeyword,
|
||||
verbose, unitReturnType, normalizedVisibilities, showInternalKeyword, prettyFunctionTypes,
|
||||
overrideRenderingPolicy, valueParametersHandler, textFormat, excludedAnnotationClasses);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.DefaultAnnotationArgumentVisitor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.constants.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.AnnotationValue;
|
||||
import org.jetbrains.jet.lang.resolve.constants.ArrayValue;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.constants.JavaClassValue;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqNameBase;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
|
||||
@@ -50,6 +53,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
private final boolean unitReturnType;
|
||||
private final boolean normalizedVisibilities;
|
||||
private final boolean showInternalKeyword;
|
||||
private final boolean prettyFunctionTypes;
|
||||
@NotNull
|
||||
private final OverrideRenderingPolicy overrideRenderingPolicy;
|
||||
@NotNull
|
||||
@@ -70,6 +74,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
boolean unitReturnType,
|
||||
boolean normalizedVisibilities,
|
||||
boolean showInternalKeyword,
|
||||
boolean prettyFunctionTypes,
|
||||
@NotNull OverrideRenderingPolicy overrideRenderingPolicy,
|
||||
@NotNull ValueParametersHandler handler,
|
||||
@NotNull TextFormat textFormat,
|
||||
@@ -89,6 +94,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
this.debugMode = debugMode;
|
||||
this.textFormat = textFormat;
|
||||
this.excludedAnnotationClasses = Sets.newHashSet(excludedAnnotationClasses);
|
||||
this.prettyFunctionTypes = prettyFunctionTypes;
|
||||
}
|
||||
|
||||
/* FORMATTING */
|
||||
@@ -223,7 +229,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
if (type.isError()) {
|
||||
return renderDefaultType(type);
|
||||
}
|
||||
if (KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(type)) {
|
||||
if (KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(type) && prettyFunctionTypes) {
|
||||
return renderFunctionType(type);
|
||||
}
|
||||
return renderDefaultType(type);
|
||||
|
||||
Reference in New Issue
Block a user