Rendering nice unicode arrow for function types in UI.

This commit is contained in:
Evgeny Gerashchenko
2012-12-27 14:14:13 +04:00
parent c483a7f7cd
commit bc9f5da47e
4 changed files with 16 additions and 5 deletions
@@ -116,6 +116,17 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
return escape("<");
}
@NotNull
private String arrow() {
switch (textFormat) {
case PLAIN:
return escape("->");
case HTML:
return "&rarr;";
}
throw new IllegalStateException("Unexpected textFormat: " + textFormat);
}
@NotNull
private String renderMessage(@NotNull String message) {
switch (textFormat) {
@@ -188,7 +199,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
return "???";
}
else if (type == CallResolverUtil.PLACEHOLDER_FUNCTION_TYPE) {
return "??? -> ???";
return "??? " + arrow() + " ???";
}
else if (ErrorUtils.isErrorType(type)) {
return type.toString();
@@ -258,7 +269,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
sb.append("(");
appendTypeProjections(KotlinBuiltIns.getInstance().getParameterTypeProjectionsFromFunctionType(type), sb);
sb.append(") -> ");
sb.append(") " + arrow() + " ");
sb.append(renderType(KotlinBuiltIns.getInstance().getReturnTypeFromFunctionType(type)));
if (type.isNullable()) {