Tuple migration quick fix now appears only on tupels shorter than 4
Longer tuples exhibit another error message. Messages adjusted for compiler and IDE
This commit is contained in:
@@ -48,7 +48,10 @@ import static org.jetbrains.jet.lang.diagnostics.Severity.WARNING;
|
||||
public interface Errors {
|
||||
|
||||
// TODO: Temporary error message: to deprecate tuples we report this error and provide a quick fix
|
||||
@Deprecated // Tuples will be dropped in Kotlin M4
|
||||
SimpleDiagnosticFactory<PsiElement> TUPLES_ARE_NOT_SUPPORTED = SimpleDiagnosticFactory.create(ERROR);
|
||||
@Deprecated // Tuples will be dropped in Kotlin M4
|
||||
SimpleDiagnosticFactory<PsiElement> TUPLES_ARE_NOT_SUPPORTED_BIG = SimpleDiagnosticFactory.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<JetFile, Throwable> EXCEPTION_WHILE_ANALYZING = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
|
||||
+2
-1
@@ -47,7 +47,8 @@ public class DefaultErrorMessages {
|
||||
static {
|
||||
|
||||
// TODO: remove when tuples are completely dropped
|
||||
MAP.put(TUPLES_ARE_NOT_SUPPORTED, "Tuples are not supported. Press Alt+Enter to replace tuples with library classes");
|
||||
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
|
||||
|
||||
@@ -37,9 +37,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.TUPLES_ARE_NOT_SUPPORTED;
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.UNSUPPORTED;
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.WRONG_NUMBER_OF_TYPE_ARGUMENTS;
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
@@ -182,7 +180,12 @@ public class TypeResolver {
|
||||
@Override
|
||||
public void visitTupleType(JetTupleType type) {
|
||||
// TODO: remove this method completely when tuples are droppped
|
||||
trace.report(TUPLES_ARE_NOT_SUPPORTED.on(type));
|
||||
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] = JetStandardClasses.getTupleType(resolveTypes(scope, type.getComponentTypeRefs(), trace, checkBounds));
|
||||
|
||||
+6
-1
@@ -357,7 +357,12 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
@Override
|
||||
public JetTypeInfo visitTupleExpression(JetTupleExpression expression, ExpressionTypingContext context) {
|
||||
// TODO: remove this method completely when tuples are droppped
|
||||
context.trace.report(TUPLES_ARE_NOT_SUPPORTED.on(expression));
|
||||
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>();
|
||||
|
||||
Reference in New Issue
Block a user