CLI: improve diagnostic message format

- render the whole line where the error/warning points to, if any, and another
  line with '^', like other compilers do
- lowercase diagnostic severity
- decapitalize the message if it doesn't start with a proper name
This commit is contained in:
Alexander Udalov
2015-06-13 03:43:20 +03:00
parent 46515afb22
commit 54dfd626ab
49 changed files with 316 additions and 134 deletions
+3 -1
View File
@@ -1,2 +1,4 @@
ERROR: compiler/testData/cli/js/diagnosticForClassLiteral.kt: (6, 5) Cannot translate (not supported yet): 'A::class'
compiler/testData/cli/js/diagnosticForClassLiteral.kt:6:5: error: cannot translate (not supported yet): 'A::class'
A::class
^
COMPILATION_ERROR
@@ -1,2 +1,4 @@
ERROR: compiler/testData/cli/js/diagnosticForUnhandledElements.kt: (9, 17) Cannot translate (not supported yet): '@fancy 1'
COMPILATION_ERROR
compiler/testData/cli/js/diagnosticForUnhandledElements.kt:9:17: error: cannot translate (not supported yet): '@fancy 1'
return (@fancy 1)
^
COMPILATION_ERROR
@@ -1,3 +1,7 @@
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'
compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt:4:5: error: callable references for builtin members are not supported yet: 'Int::toByte'
Int::toByte
^
compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt:5:5: error: callable references for builtin members are not supported yet: 'String::length'
String::length
^
COMPILATION_ERROR
+2 -2
View File
@@ -1,2 +1,2 @@
ERROR: No source files
COMPILATION_ERROR
error: no source files
COMPILATION_ERROR
+7 -3
View File
@@ -1,3 +1,7 @@
ERROR: compiler/testData/cli/js/inlineCycle.kt: (2, 5) The 'b' invocation is a part of inline cycle
ERROR: compiler/testData/cli/js/inlineCycle.kt: (15, 5) The 'a' invocation is a part of inline cycle
COMPILATION_ERROR
compiler/testData/cli/js/inlineCycle.kt:2:5: error: the 'b' invocation is a part of inline cycle
b(l)
^
compiler/testData/cli/js/inlineCycle.kt:15:5: error: the 'a' invocation is a part of inline cycle
a(p)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,2 +1,2 @@
ERROR: Path 'not/existing/path' does not exist
error: path 'not/existing/path' does not exist
COMPILATION_ERROR
+2 -2
View File
@@ -1,2 +1,2 @@
ERROR: Source file or directory not found: not/existing/path
COMPILATION_ERROR
error: source file or directory not found: not/existing/path
COMPILATION_ERROR
+2 -2
View File
@@ -1,2 +1,2 @@
ERROR: 'compiler/testData/integration/ant/js/simpleWithStdlibAndFolderAsAnotherLib' is not a valid Kotlin Javascript library
COMPILATION_ERROR
error: 'compiler/testData/integration/ant/js/simpleWithStdlibAndFolderAsAnotherLib' is not a valid Kotlin Javascript library
COMPILATION_ERROR
+2 -2
View File
@@ -1,2 +1,2 @@
ERROR: Cannot open output file 'compiler/testData/cli/js': is a directory
COMPILATION_ERROR
error: cannot open output file 'compiler/testData/cli/js': is a directory
COMPILATION_ERROR
+1 -1
View File
@@ -1,2 +1,2 @@
ERROR: Output postfix file 'not/existing/path' not found
error: output postfix file 'not/existing/path' not found
COMPILATION_ERROR
+1 -1
View File
@@ -1,2 +1,2 @@
ERROR: Output prefix file 'not/existing/path' not found
error: output prefix file 'not/existing/path' not found
COMPILATION_ERROR
+2 -2
View File
@@ -1,2 +1,2 @@
ERROR: File 'compiler/testData/cli/js/wrongAbiVersionLib/wrongAbiLib.meta.js' was compiled with an incompatible version of Kotlin. Its ABI version is 0, expected ABI version is 3
COMPILATION_ERROR
error: file 'compiler/testData/cli/js/wrongAbiVersionLib/wrongAbiLib.meta.js' was compiled with an incompatible version of Kotlin. Its ABI version is 0, expected ABI version is 3
COMPILATION_ERROR
+16 -6
View File
@@ -1,6 +1,16 @@
WARNING: compiler/testData/cli/jvm/classpath.kt: (8, 9) Variable 'a' is never used
WARNING: compiler/testData/cli/jvm/classpath.kt: (9, 9) Variable 'c' is never used
WARNING: compiler/testData/cli/jvm/classpath.kt: (10, 9) Variable 'e' is never used
WARNING: compiler/testData/cli/jvm/classpath.kt: (11, 9) Variable 'f' is never used
WARNING: compiler/testData/cli/jvm/classpath.kt: (12, 9) Variable 'j' is never used
OK
compiler/testData/cli/jvm/classpath.kt:8:9: warning: variable 'a' is never used
val a = Big5() // charsets.jar
^
compiler/testData/cli/jvm/classpath.kt:9:9: warning: variable 'c' is never used
val c = DNSNameService() // dnsns.ajr
^
compiler/testData/cli/jvm/classpath.kt:10:9: warning: variable 'e' is never used
val e : Cipher? = null // jce.jar
^
compiler/testData/cli/jvm/classpath.kt:11:9: warning: variable 'f' is never used
val f : SunJCE? = null // sunjce_provider.jar
^
compiler/testData/cli/jvm/classpath.kt:12:9: warning: variable 'j' is never used
val j : ByteBuffered? = null // rt.jar
^
OK
+7 -3
View File
@@ -1,3 +1,7 @@
ERROR: compiler/testData/cli/jvm/conflictingOverloads.kt: (1, 1) 'internal fun a(): kotlin.List<kotlin.Int>' is already defined in root package
ERROR: compiler/testData/cli/jvm/conflictingOverloads.kt: (2, 1) 'internal fun a(): kotlin.List<kotlin.String>' is already defined in root package
COMPILATION_ERROR
compiler/testData/cli/jvm/conflictingOverloads.kt:1:1: error: 'internal fun a(): kotlin.List<kotlin.Int>' is already defined in root package
fun a(): List<Int> = null!!
^
compiler/testData/cli/jvm/conflictingOverloads.kt:2:1: error: 'internal fun a(): kotlin.List<kotlin.String>' is already defined in root package
fun a(): List<String> = null!!
^
COMPILATION_ERROR
+27 -9
View File
@@ -1,10 +1,28 @@
ERROR: compiler/testData/cli/jvm/diagnosticsOrder1.kt: (1, 5) Redeclaration: x
ERROR: compiler/testData/cli/jvm/diagnosticsOrder1.kt: (2, 5) Redeclaration: x
ERROR: compiler/testData/cli/jvm/diagnosticsOrder1.kt: (3, 5) Redeclaration: x
ERROR: compiler/testData/cli/jvm/diagnosticsOrder1.kt: (4, 5) Redeclaration: x
ERROR: compiler/testData/cli/jvm/diagnosticsOrder1.kt: (5, 5) Redeclaration: x
ERROR: compiler/testData/cli/jvm/diagnosticsOrder1.kt: (6, 5) Redeclaration: x
ERROR: compiler/testData/cli/jvm/diagnosticsOrder1.kt: (7, 5) Redeclaration: x
ERROR: compiler/testData/cli/jvm/diagnosticsOrder2.kt: (1, 5) Redeclaration: y
ERROR: compiler/testData/cli/jvm/diagnosticsOrder2.kt: (2, 5) Redeclaration: y
compiler/testData/cli/jvm/diagnosticsOrder1.kt:1:5: error: redeclaration: x
val x = 5
^
compiler/testData/cli/jvm/diagnosticsOrder1.kt:2:5: error: redeclaration: x
val x = 5
^
compiler/testData/cli/jvm/diagnosticsOrder1.kt:3:5: error: redeclaration: x
val x = 5
^
compiler/testData/cli/jvm/diagnosticsOrder1.kt:4:5: error: redeclaration: x
val x = 5
^
compiler/testData/cli/jvm/diagnosticsOrder1.kt:5:5: error: redeclaration: x
val x = 5
^
compiler/testData/cli/jvm/diagnosticsOrder1.kt:6:5: error: redeclaration: x
val x = 5
^
compiler/testData/cli/jvm/diagnosticsOrder1.kt:7:5: error: redeclaration: x
val x = 5
^
compiler/testData/cli/jvm/diagnosticsOrder2.kt:1:5: error: redeclaration: y
val y = 5
^
compiler/testData/cli/jvm/diagnosticsOrder2.kt:2:5: error: redeclaration: y
val y = 5
^
COMPILATION_ERROR
+2 -2
View File
@@ -1,2 +1,2 @@
WARNING: Duplicate source root: compiler/testData/cli/jvm/simple.kt
OK
warning: duplicate source root: compiler/testData/cli/jvm/simple.kt
OK
+2 -2
View File
@@ -1,2 +1,2 @@
WARNING: Duplicate source root: $TESTDATA_DIR$/duplicateSourcesInModule.kt
OK
warning: duplicate source root: $TESTDATA_DIR$/duplicateSourcesInModule.kt
OK
+2 -2
View File
@@ -1,2 +1,2 @@
ERROR: No source files
COMPILATION_ERROR
error: no source files
COMPILATION_ERROR
+7 -3
View File
@@ -1,3 +1,7 @@
ERROR: compiler/testData/cli/jvm/inlineCycle.kt: (2, 5) The 'b' invocation is a part of inline cycle
ERROR: compiler/testData/cli/jvm/inlineCycle.kt: (15, 5) The 'a' invocation is a part of inline cycle
COMPILATION_ERROR
compiler/testData/cli/jvm/inlineCycle.kt:2:5: error: the 'b' invocation is a part of inline cycle
b(l)
^
compiler/testData/cli/jvm/inlineCycle.kt:15:5: error: the 'a' invocation is a part of inline cycle
a(p)
^
COMPILATION_ERROR
@@ -1,4 +1,10 @@
ERROR: compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt: (6, 14) Cannot weaken access privilege 'public' for 'c' in 'A'
ERROR: compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt: (6, 14) Incompatible modifiers: 'private protected'
ERROR: compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt: (6, 24) Incompatible modifiers: 'private protected'
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: cannot weaken access privilege 'public' for 'c' in 'A'
override protected private val c: Int
^
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: incompatible modifiers: 'private protected'
override protected private val c: Int
^
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:24: error: incompatible modifiers: 'private protected'
override protected private val c: Int
^
COMPILATION_ERROR
+6 -2
View File
@@ -1,3 +1,7 @@
ERROR: compiler/testData/cli/jvm/noReflectionInClasspath.kt: (3, 12) Expression 'Foo::prop' uses reflection which is not found in compilation classpath. Make sure you have kotlin-reflect.jar in the classpath
ERROR: compiler/testData/cli/jvm/noReflectionInClasspath.kt: (4, 12) Expression 'Foo::class' uses reflection which is not found in compilation classpath. Make sure you have kotlin-reflect.jar in the classpath
compiler/testData/cli/jvm/noReflectionInClasspath.kt:3:12: error: expression 'Foo::prop' uses reflection which is not found in compilation classpath. Make sure you have kotlin-reflect.jar in the classpath
fun t1() = Foo::prop
^
compiler/testData/cli/jvm/noReflectionInClasspath.kt:4:12: error: expression 'Foo::class' uses reflection which is not found in compilation classpath. Make sure you have kotlin-reflect.jar in the classpath
fun t2() = Foo::class
^
COMPILATION_ERROR
@@ -1,3 +1,3 @@
WARNING: Classpath entry points to a non-existent location: not/existing/path
WARNING: Annotations path entry points to a non-existent location: yet/another/not/existing/path
warning: classpath entry points to a non-existent location: not/existing/path
warning: annotations path entry points to a non-existent location: yet/another/not/existing/path
OK
+1 -1
View File
@@ -1,2 +1,2 @@
ERROR: Source file or directory not found: not/existing/path
error: source file or directory not found: not/existing/path
COMPILATION_ERROR
+7 -3
View File
@@ -1,3 +1,7 @@
ERROR: compiler/testData/cli/jvm/nonLocalDisabled.kt: (3, 9) Non-local returns are not allowed with inlining disabled
ERROR: compiler/testData/cli/jvm/nonLocalDisabled.kt: (7, 9) Non-local returns are not allowed with inlining disabled
COMPILATION_ERROR
compiler/testData/cli/jvm/nonLocalDisabled.kt:3:9: error: non-local returns are not allowed with inlining disabled
return
^
compiler/testData/cli/jvm/nonLocalDisabled.kt:7:9: error: non-local returns are not allowed with inlining disabled
return@a
^
COMPILATION_ERROR
+2 -2
View File
@@ -1,8 +1,8 @@
ERROR: Required plugin option not present: org.jetbrains.kotlin.android:androidRes
error: required plugin option not present: org.jetbrains.kotlin.android:androidRes
Plugin "org.jetbrains.kotlin.android" usage:
androidRes <path> Android resources path (required, multiple)
androidManifest <path> Android manifest file (required)
supportV4 <path> Support android-v4 library
COMPILATION_ERROR
COMPILATION_ERROR
+28 -10
View File
@@ -1,28 +1,46 @@
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (6, 5) Accidental override: The following declarations have the same JVM signature (getX()I):
compiler/testData/cli/jvm/signatureClash.kt:6:5: error: accidental override: The following declarations have the same JVM signature (getX()I):
fun getX(): kotlin.Int
fun <get-x>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (8, 5) Platform declaration clash: The following declarations have the same JVM signature (getA()I):
fun getX() = 1
^
compiler/testData/cli/jvm/signatureClash.kt:8:5: error: platform declaration clash: The following declarations have the same JVM signature (getA()I):
fun getA(): kotlin.Int
fun <get-a>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (9, 5) Platform declaration clash: The following declarations have the same JVM signature (getA()I):
fun getA(): Int = 1
^
compiler/testData/cli/jvm/signatureClash.kt:9:5: error: platform declaration clash: The following declarations have the same JVM signature (getA()I):
fun getA(): kotlin.Int
fun <get-a>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (12, 1) Platform declaration clash: The following declarations have the same JVM signature (getB()I):
val a: Int = 1
^
compiler/testData/cli/jvm/signatureClash.kt:12:1: error: platform declaration clash: The following declarations have the same JVM signature (getB()I):
fun <get-b>(): kotlin.Int
fun getB(): kotlin.Int
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (13, 1) Platform declaration clash: The following declarations have the same JVM signature (getB()I):
fun getB(): Int = 1
^
compiler/testData/cli/jvm/signatureClash.kt:13:1: error: platform declaration clash: The following declarations have the same JVM signature (getB()I):
fun <get-b>(): kotlin.Int
fun getB(): kotlin.Int
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (19, 7) Platform declaration clash: The following declarations have the same JVM signature (getTr()I):
val b: Int = 1
^
compiler/testData/cli/jvm/signatureClash.kt:19:7: error: platform declaration clash: The following declarations have the same JVM signature (getTr()I):
fun <get-tr>(): kotlin.Int
fun getTr(): kotlin.Int
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (20, 5) Platform declaration clash: The following declarations have the same JVM signature (getTr()I):
class SubTr : Tr {
^
compiler/testData/cli/jvm/signatureClash.kt:20:5: error: platform declaration clash: The following declarations have the same JVM signature (getTr()I):
fun <get-tr>(): kotlin.Int
fun getTr(): kotlin.Int
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (24, 7) Platform declaration clash: The following declarations have the same JVM signature (access$f$0(LC;)V):
val tr = 1
^
compiler/testData/cli/jvm/signatureClash.kt:24:7: error: platform declaration clash: The following declarations have the same JVM signature (access$f$0(LC;)V):
fun `access$f$0`(c: C): kotlin.Unit
fun f(): kotlin.Unit
ERROR: compiler/testData/cli/jvm/signatureClash.kt: (26, 5) Platform declaration clash: The following declarations have the same JVM signature (access$f$0(LC;)V):
class C {
^
compiler/testData/cli/jvm/signatureClash.kt:26:5: error: platform declaration clash: The following declarations have the same JVM signature (access$f$0(LC;)V):
fun `access$f$0`(c: C): kotlin.Unit
fun f(): kotlin.Unit
COMPILATION_ERROR
fun `access$f$0`(c: C) {}
^
COMPILATION_ERROR
@@ -1,19 +1,31 @@
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (15, 5) Accidental override: The following declarations have the same JVM signature (access$foo$0(LDerived;)V):
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:15:5: error: accidental override: The following declarations have the same JVM signature (access$foo$0(LDerived;)V):
fun `access$foo$0`(d: Derived): kotlin.Unit
fun foo(): kotlin.Unit
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (18, 9) Accidental override: The following declarations have the same JVM signature (access$getBar$1(LDerived;)I):
private fun foo() {}
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:18:9: error: accidental override: The following declarations have the same JVM signature (access$getBar$1(LDerived;)I):
fun `access$getBar$1`(d: Derived): kotlin.Int
fun <get-bar>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (19, 9) Accidental override: The following declarations have the same JVM signature (access$setBar$1(LDerived;I)V):
get
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:19:9: error: accidental override: The following declarations have the same JVM signature (access$setBar$1(LDerived;I)V):
fun `access$setBar$1`(d: Derived, i: kotlin.Int): kotlin.Unit
fun <set-bar>(<set-?>: kotlin.Int): kotlin.Unit
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (21, 5) Accidental override: The following declarations have the same JVM signature (access$getBaz$2(LDerived;)I):
set
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:21:5: error: accidental override: The following declarations have the same JVM signature (access$getBaz$2(LDerived;)I):
fun `access$getBaz$2`(d: Derived): kotlin.Int
fun <get-baz>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (23, 5) Accidental override: The following declarations have the same JVM signature (access$getBoo$3(LDerived;)I):
private var baz = 1
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:23:5: error: accidental override: The following declarations have the same JVM signature (access$getBoo$3(LDerived;)I):
fun `access$getBoo$3`(d: Derived): kotlin.Int
fun <get-boo>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (27, 9) Accidental override: The following declarations have the same JVM signature (access$setBar1$4(LDerived;I)V):
private val boo = 1
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:27:9: error: accidental override: The following declarations have the same JVM signature (access$setBar1$4(LDerived;I)V):
fun `access$setBar1$4`(d: Derived, i: kotlin.Int): kotlin.Unit
fun <set-bar1>(<set-?>: kotlin.Int): kotlin.Unit
COMPILATION_ERROR
set
^
COMPILATION_ERROR
+6 -4
View File
@@ -1,4 +1,6 @@
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/ClassWithWrongAbiVersion.class: 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: 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/wrongAbiVersion.kt: (4, 3) Unresolved reference: bar
COMPILATION_ERROR
compiler/testData/cli/jvm/wrongAbiVersionLib/bin/ClassWithWrongAbiVersion.class: error: class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
compiler/testData/cli/jvm/wrongAbiVersionLib/bin/wrong/WrongPackage.class: error: class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
compiler/testData/cli/jvm/wrongAbiVersion.kt:4:3: error: unresolved reference: bar
bar()
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
ERROR: The following Java entities have annotations with wrong Kotlin signatures:
error: the following Java entities have annotations with wrong Kotlin signatures:
library.ClassWithWrongKotlinSignatures java.lang.String foo():
Function names mismatch, original: foo, alternative: bar
library.ClassWithWrongKotlinSignatures java.lang.String bar():
+2 -2
View File
@@ -1,2 +1,2 @@
ERROR: Specify script source path to evaluate
COMPILATION_ERROR
error: specify script source path to evaluate
COMPILATION_ERROR