Don't report warnings when there are errors
All sane compilers do this
This commit is contained in:
+13
-5
@@ -20,8 +20,6 @@ import com.google.common.collect.LinkedHashMultimap;
|
|||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class GroupingMessageCollector implements MessageCollector {
|
public class GroupingMessageCollector implements MessageCollector {
|
||||||
|
|
||||||
private final MessageCollector delegate;
|
private final MessageCollector delegate;
|
||||||
@@ -48,12 +46,22 @@ public class GroupingMessageCollector implements MessageCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void flush() {
|
public void flush() {
|
||||||
|
boolean hasError = false;
|
||||||
|
|
||||||
for (String path : groupedMessages.keySet()) {
|
for (String path : groupedMessages.keySet()) {
|
||||||
Collection<Message> messages = groupedMessages.get(path);
|
for (Message message : groupedMessages.get(path)) {
|
||||||
for (Message message : messages) {
|
hasError |= CompilerMessageSeverity.ERRORS.contains(message.severity);
|
||||||
delegate.report(message.severity, message.message, message.location);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (String path : groupedMessages.keySet()) {
|
||||||
|
for (Message message : groupedMessages.get(path)) {
|
||||||
|
if (!hasError || CompilerMessageSeverity.ERRORS.contains(message.severity)) {
|
||||||
|
delegate.report(message.severity, message.message, message.location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
groupedMessages.clear();
|
groupedMessages.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
WARNING: compiler/testData/cli/js/diagnosticForClassLiteral.kt: (6, 5) The expression is unused
|
|
||||||
ERROR: compiler/testData/cli/js/diagnosticForClassLiteral.kt: (6, 5) Cannot translate (not supported yet): 'A::class'
|
ERROR: compiler/testData/cli/js/diagnosticForClassLiteral.kt: (6, 5) Cannot translate (not supported yet): 'A::class'
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
WARNING: compiler/testData/cli/js/diagnosticForUnhandledElements.kt: (8, 20) Parameter 'foo' is never used
|
|
||||||
ERROR: compiler/testData/cli/js/diagnosticForUnhandledElements.kt: (9, 17) Cannot translate (not supported yet): '@fancy 1'
|
ERROR: compiler/testData/cli/js/diagnosticForUnhandledElements.kt: (9, 17) Cannot translate (not supported yet): '@fancy 1'
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
WARNING: compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt: (4, 5) The expression is unused
|
|
||||||
WARNING: compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt: (5, 5) The expression is unused
|
|
||||||
ERROR: compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt: (4, 5) Callable references for builtin members are not supported yet: 'Int::toByte'
|
ERROR: compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt: (4, 5) Callable references for builtin members are not supported yet: 'Int::toByte'
|
||||||
ERROR: compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt: (5, 5) Callable references for builtin members are not supported yet: 'String::length'
|
ERROR: compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt: (5, 5) Callable references for builtin members are not supported yet: 'String::length'
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
WARNING: compiler/testData/cli/jvm/signatureClash.kt: (26, 22) Parameter 'c' is never used
|
|
||||||
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (6, 5) Accidental override: The following declarations have the same JVM signature (getX()I):
|
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (6, 5) Accidental override: The following declarations have the same JVM signature (getX()I):
|
||||||
fun getX(): kotlin.Int
|
fun getX(): kotlin.Int
|
||||||
fun <get-x>(): kotlin.Int
|
fun <get-x>(): kotlin.Int
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
WARNING: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (34, 17) Variable 's' is never used
|
|
||||||
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (15, 5) Accidental override: The following declarations have the same JVM signature (access$foo$0(LDerived;)V):
|
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (15, 5) Accidental override: The following declarations have the same JVM signature (access$foo$0(LDerived;)V):
|
||||||
fun `access$foo$0`(d: Derived): kotlin.Unit
|
fun `access$foo$0`(d: Derived): kotlin.Unit
|
||||||
fun foo(): kotlin.Unit
|
fun foo(): kotlin.Unit
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/ClassWithWrongAbiVersion.class: (0, 0) Class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/ClassWithWrongAbiVersion.class: (0, 0) Class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
||||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/wrong/WrongPackage.class: (0, 0) Class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/wrong/WrongPackage.class: (0, 0) Class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
||||||
WARNING: compiler/testData/cli/jvm/wrongAbiVersion.kt: (3, 9) Parameter 'x' is never used
|
|
||||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersion.kt: (4, 3) Unresolved reference: bar
|
ERROR: compiler/testData/cli/jvm/wrongAbiVersion.kt: (4, 3) Unresolved reference: bar
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
Reference in New Issue
Block a user