Removed "tuples not supported" diagnostic.

This commit is contained in:
Evgeny Gerashchenko
2013-03-18 21:11:50 +04:00
parent cb4d680790
commit bf28ce155d
5 changed files with 2 additions and 48 deletions
@@ -54,12 +54,6 @@ public interface Errors {
DiagnosticFactory1<PsiElement, String> UNSUPPORTED = DiagnosticFactory1.create(ERROR);
// TODO: Temporary error message: to deprecate tuples we report this error and provide a quick fix
@Deprecated // Tuples will be dropped in Kotlin M4
DiagnosticFactory0<PsiElement> TUPLES_ARE_NOT_SUPPORTED = DiagnosticFactory0.create(ERROR);
@Deprecated // Tuples will be dropped in Kotlin M4
DiagnosticFactory0<PsiElement> TUPLES_ARE_NOT_SUPPORTED_BIG = DiagnosticFactory0.create(ERROR);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Generic errors/warnings: applicable in many contexts
@@ -40,11 +40,6 @@ public class DefaultErrorMessages {
public static final DiagnosticRenderer<Diagnostic> RENDERER = new DispatchingDiagnosticRenderer(MAP);
static {
// TODO: remove when tuples are completely dropped
MAP.put(TUPLES_ARE_NOT_SUPPORTED, "Tuples are not supported. In the IDE you can use Alt+Enter to replace tuples with library classes");
MAP.put(TUPLES_ARE_NOT_SUPPORTED_BIG, "Tuples are not supported. Use data classes instead");
MAP.put(EXCEPTION_WHILE_ANALYZING, "{0}", new Renderer<Throwable>() {
@NotNull
@Override
@@ -195,15 +195,7 @@ public class TypeResolver {
@Override
public void visitTupleType(JetTupleType type) {
// TODO: remove this method completely when tuples are droppped
if (type.getComponentTypeRefs().size() <= 3) {
trace.report(TUPLES_ARE_NOT_SUPPORTED.on(type));
}
else {
trace.report(TUPLES_ARE_NOT_SUPPORTED_BIG.on(type));
}
// TODO labels
result[0] = KotlinBuiltIns.getInstance().getTupleType(resolveTypes(scope, type.getComponentTypeRefs(), trace, checkBounds));
throw new IllegalStateException("Tuples are not supported: " + type.getText());
}
@Override
@@ -365,26 +365,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
@Override
public JetTypeInfo visitTupleExpression(JetTupleExpression expression, ExpressionTypingContext context) {
// TODO: remove this method completely when tuples are droppped
if (expression.getEntries().size() <= 3) {
context.trace.report(TUPLES_ARE_NOT_SUPPORTED.on(expression));
}
else {
context.trace.report(TUPLES_ARE_NOT_SUPPORTED_BIG.on(expression));
}
List<JetExpression> entries = expression.getEntries();
List<JetType> types = new ArrayList<JetType>();
for (JetExpression entry : entries) {
types.add(context.expressionTypingServices.safeGetType(context.scope, entry, NO_EXPECTED_TYPE, context.dataFlowInfo, context.trace)); // TODO
}
if (context.expectedType != NO_EXPECTED_TYPE && KotlinBuiltIns.getInstance().isTupleType(context.expectedType)) {
List<JetType> enrichedTypes = checkArgumentTypes(types, entries, context.expectedType.getArguments(), context);
if (enrichedTypes != types) {
return JetTypeInfo.create(KotlinBuiltIns.getInstance().getTupleType(enrichedTypes), context.dataFlowInfo);
}
}
// TODO : labels
return DataFlowUtils.checkType(KotlinBuiltIns.getInstance().getTupleType(types), expression, context, context.dataFlowInfo);
throw new IllegalStateException("Tuples are not supported: " + expression.getText());
}
@NotNull
@@ -39,14 +39,6 @@ public class IdeErrorMessages {
public static final DiagnosticRenderer<Diagnostic> RENDERER = new DispatchingDiagnosticRenderer(MAP, DefaultErrorMessages.MAP);
static {
// TODO: Remove when tuples are completely dropped
MAP.put(TUPLES_ARE_NOT_SUPPORTED, "<html>Tuples are not supported. Press <b>Alt+Enter</b> to replace tuples with library classes</html>");
MAP.put(TUPLES_ARE_NOT_SUPPORTED_BIG, "<html>" +
"Tuples are not supported.<br/>" +
"Use data classes instead. For example:<br/>" +
"<b>data class</b> FourThings(<b>val</b> a: A, <b>val</b> b: B, <b>val</b> c: C, <b>val</b> d: D)" +
"</html>");
MAP.put(TYPE_MISMATCH, "<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table></html>",
HTML_RENDER_TYPE, HTML_RENDER_TYPE);