diff --git a/idea/testData/diagnosticMessage/upperBoundViolated.kt b/idea/testData/diagnosticMessage/upperBoundViolated.kt
index 3edeb931709..1ac0c1beadd 100644
--- a/idea/testData/diagnosticMessage/upperBoundViolated.kt
+++ b/idea/testData/diagnosticMessage/upperBoundViolated.kt
@@ -1,5 +1,6 @@
// !DIAGNOSTICS_NUMBER: 3
// !DIAGNOSTICS: TYPE_INFERENCE_UPPER_BOUND_VIOLATED
+// !MESSAGE_TYPE: TEXT
package i
diff --git a/idea/testData/diagnosticMessage/upperBoundViolated1.html b/idea/testData/diagnosticMessage/upperBoundViolated1.html
deleted file mode 100644
index 640fe9725bf..00000000000
--- a/idea/testData/diagnosticMessage/upperBoundViolated1.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-Type parameter bound for
-T
- in
-
-|
- |
-
-
-fun
- <R, T : jet.List<R>>
- foo |
-
-( |
-
-r: R, |
-
-list: T |
-
-) |
-
-: jet.Unit |
-
-
- is not satisfied: inferred type
-
-jet.Collection<jet.Int>
-
- is not a subtype of
-jet.List<jet.Int>
-
\ No newline at end of file
diff --git a/idea/testData/diagnosticMessage/upperBoundViolated1.txt b/idea/testData/diagnosticMessage/upperBoundViolated1.txt
new file mode 100644
index 00000000000..d5547eb5cc9
--- /dev/null
+++ b/idea/testData/diagnosticMessage/upperBoundViolated1.txt
@@ -0,0 +1,3 @@
+
+Type parameter bound for T in fun > foo(r: R, list: T): jet.Unit
+ is not satisfied: inferred type jet.Collection is not a subtype of jet.List
\ No newline at end of file
diff --git a/idea/testData/diagnosticMessage/upperBoundViolated2.html b/idea/testData/diagnosticMessage/upperBoundViolated2.html
deleted file mode 100644
index a410c813008..00000000000
--- a/idea/testData/diagnosticMessage/upperBoundViolated2.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-Type parameter bound for
-V
- in
-
-|
- |
-
-
-fun
- <V : U, U>
- bar |
-
-( |
-
-v: V, |
-
-u: jet.MutableSet<U> |
-
-) |
-
-: jet.MutableSet<U> |
-
-
- is not satisfied: inferred type
-
-jet.Any
-
- is not a subtype of
-jet.String
-
diff --git a/idea/testData/diagnosticMessage/upperBoundViolated2.txt b/idea/testData/diagnosticMessage/upperBoundViolated2.txt
new file mode 100644
index 00000000000..1a2f189c4f3
--- /dev/null
+++ b/idea/testData/diagnosticMessage/upperBoundViolated2.txt
@@ -0,0 +1,3 @@
+
+Type parameter bound for V in fun bar(v: V, u: jet.MutableSet): jet.MutableSet
+ is not satisfied: inferred type jet.Any is not a subtype of jet.String
\ No newline at end of file
diff --git a/idea/testData/diagnosticMessage/upperBoundViolated3.html b/idea/testData/diagnosticMessage/upperBoundViolated3.html
deleted file mode 100644
index bff5b9b62b2..00000000000
--- a/idea/testData/diagnosticMessage/upperBoundViolated3.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-Type parameter bound for
-T
- in
-
-|
- |
-
-
-fun
- <T : R, R : i.B>
- baz |
-
-( |
-
-t: T, |
-
-r: R |
-
-) |
-
-: jet.Unit
-where
- T : i.A |
-
-
- is not satisfied: inferred type
-
-i.A
-
- is not a subtype of
-i.B
-
diff --git a/idea/testData/diagnosticMessage/upperBoundViolated3.txt b/idea/testData/diagnosticMessage/upperBoundViolated3.txt
new file mode 100644
index 00000000000..fbc7bcc78a2
--- /dev/null
+++ b/idea/testData/diagnosticMessage/upperBoundViolated3.txt
@@ -0,0 +1,3 @@
+
+Type parameter bound for T in fun baz(t: T, r: R): jet.Unit where T : i.A
+ is not satisfied: inferred type i.A is not a subtype of i.B
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/jet/plugin/highlighter/AbstractDiagnosticMessageTest.java b/idea/tests/org/jetbrains/jet/plugin/highlighter/AbstractDiagnosticMessageTest.java
index ddf7deddd58..92a8520efd1 100644
--- a/idea/tests/org/jetbrains/jet/plugin/highlighter/AbstractDiagnosticMessageTest.java
+++ b/idea/tests/org/jetbrains/jet/plugin/highlighter/AbstractDiagnosticMessageTest.java
@@ -20,6 +20,8 @@ import com.google.common.collect.Sets;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.ConfigurationKind;
import org.jetbrains.jet.JetLiteFixture;
import org.jetbrains.jet.JetTestUtils;
@@ -45,6 +47,19 @@ import java.util.Set;
public abstract class AbstractDiagnosticMessageTest extends JetLiteFixture {
private static final String DIAGNOSTICS_NUMBER_DIRECTIVE = "DIAGNOSTICS_NUMBER";
private static final String DIAGNOSTICS_DIRECTIVE = "DIAGNOSTICS";
+ private static final String MESSAGE_TYPE_DIRECTIVE = "MESSAGE_TYPE";
+
+ private enum MessageType {
+ TEXT("TEXT", "txt"), HTML("HTML", "html");
+
+ public final String directive;
+ public final String extension;
+
+ MessageType(String directive, String extension) {
+ this.directive = directive;
+ this.extension = extension;
+ }
+ }
@Override
protected JetCoreEnvironment createEnvironment() {
@@ -62,8 +77,9 @@ public abstract class AbstractDiagnosticMessageTest extends JetLiteFixture {
String fileData = JetTestUtils.doLoadFile(file);
Map directives = JetTestUtils.parseDirectives(fileData);
- int diagnosticNumber = computeDiagnosticNumber(directives);
- final Set diagnosticFactories = computeDiagnosticFactories(directives);
+ int diagnosticNumber = getDiagnosticNumber(directives);
+ final Set diagnosticFactories = getDiagnosticFactories(directives);
+ MessageType messageType = getMessageTypeDirective(directives);
JetFile psiFile = createPsiFile(null, fileName, loadFile(fileName));
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, Collections.emptyList());
@@ -83,13 +99,13 @@ public abstract class AbstractDiagnosticMessageTest extends JetLiteFixture {
for (Diagnostic diagnostic : diagnostics) {
String readableDiagnosticText;
String extension;
- if (IdeErrorMessages.MAP.get(diagnostic.getFactory()) != null) {
+ if (messageType != MessageType.TEXT && IdeErrorMessages.MAP.get(diagnostic.getFactory()) != null) {
readableDiagnosticText = IdeErrorMessages.RENDERER.render(diagnostic).replaceAll(">", ">\n");
- extension = "html";
+ extension = MessageType.HTML.extension;
}
else {
readableDiagnosticText = DefaultErrorMessages.RENDERER.render(diagnostic);
- extension = "txt";
+ extension = MessageType.TEXT.extension;
}
String errorMessageFileName = name + index;
String path = getTestDataPath() + "/" + errorMessageFileName + "." + extension;
@@ -100,7 +116,7 @@ public abstract class AbstractDiagnosticMessageTest extends JetLiteFixture {
}
}
- private int computeDiagnosticNumber(Map directives) {
+ private static int getDiagnosticNumber(Map directives) {
String diagnosticsNumber = directives.get(DIAGNOSTICS_NUMBER_DIRECTIVE);
assert diagnosticsNumber != null : DIAGNOSTICS_NUMBER_DIRECTIVE + " should be present.";
try {
@@ -111,7 +127,8 @@ public abstract class AbstractDiagnosticMessageTest extends JetLiteFixture {
}
}
- private Set computeDiagnosticFactories(Map directives) {
+ @NotNull
+ private static Set getDiagnosticFactories(Map directives) {
String diagnosticsData = directives.get(DIAGNOSTICS_DIRECTIVE);
assert diagnosticsData != null : DIAGNOSTICS_DIRECTIVE + " should be present.";
Set diagnosticFactories = Sets.newHashSet();
@@ -137,4 +154,17 @@ public abstract class AbstractDiagnosticMessageTest extends JetLiteFixture {
}
return diagnosticFactories;
}
+
+ @Nullable
+ private static MessageType getMessageTypeDirective(Map directives) {
+ String messageType = directives.get(MESSAGE_TYPE_DIRECTIVE);
+ if (messageType == null) return null;
+ try {
+ return MessageType.valueOf(messageType);
+ }
+ catch (IllegalArgumentException e) {
+ throw new AssertionError(MESSAGE_TYPE_DIRECTIVE + " should be " + MessageType.TEXT.directive + " or " +
+ MessageType.HTML.directive + ". But was: \"" + messageType + "\".");
+ }
+ }
}