render not inferred return/parameter type of function literals as ???

instead of DONT_CARE / CANT_INFER
This commit is contained in:
Svetlana Isakova
2013-02-06 16:18:43 +04:00
parent 1a072e816a
commit d418a16dd8
5 changed files with 9 additions and 9 deletions
@@ -39,6 +39,7 @@ import java.util.List;
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE;
import static org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils.CANNOT_BE_INFERRED;
public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
protected ClosureExpressionsTypingVisitor(@NotNull ExpressionTypingInternals facade) {
@@ -224,7 +225,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
type = expectedType;
}
else {
type = ErrorUtils.createErrorType("Cannot be inferred");
type = CANNOT_BE_INFERRED;
}
}
return context.expressionTypingServices.getDescriptorResolver().resolveValueParameterDescriptor(
@@ -255,7 +256,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
return KotlinBuiltIns.getInstance().getUnitType();
}
}
return returnType == null ? ErrorUtils.createErrorType("<return type>") : returnType;
return returnType == null ? CANNOT_BE_INFERRED : returnType;
}
@Nullable
@@ -62,6 +62,8 @@ public class ExpressionTypingUtils {
private ExpressionTypingUtils() {
}
public static final JetType CANNOT_BE_INFERRED = ErrorUtils.createErrorType("Cannot be inferred");
@Nullable
protected static ExpressionReceiver getExpressionReceiver(@NotNull JetExpression expression, @Nullable JetType type) {
if (type == null) return null;
@@ -25,11 +25,11 @@ import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.calls.CallResolverUtil;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.*;
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.lexer.JetKeywordToken;
import org.jetbrains.jet.lexer.JetTokens;
@@ -194,12 +194,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
}
private String renderTypeWithoutEscape(@NotNull JetType type) {
if (type == CallResolverUtil.DONT_CARE || type == CallResolverUtil.CANT_INFER) {
if (type == ExpressionTypingUtils.CANNOT_BE_INFERRED) {
return "???";
}
else if (type == CallResolverUtil.PLACEHOLDER_FUNCTION_TYPE) {
return "??? " + arrow() + " ???";
}
else if (ErrorUtils.isErrorType(type)) {
return type.toString();
}
@@ -36,7 +36,7 @@ cannot be applied to</td>
<td align="right" style="white-space:nowrap;">
<font color=red>
<b>
??? &rarr; ???</b>
() &rarr; ???</b>
</font>
</td>
<td style="white-space:nowrap;">
@@ -36,7 +36,7 @@ cannot be applied to</td>
<td align="right" style="white-space:nowrap;">
<font color=red>
<b>
(jet.Int) &rarr; ???</b>
(jet.Int) &rarr; jet.Int</b>
</font>
</td>
<td style="white-space:nowrap;">