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,8 +3,8 @@ Buildfile: [TestData]/build.xml
build:
[kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
[kotlin2js] LOGGING: Compiling source files: [TestData]/root1/foo.kt
[kotlin2js] OUTPUT: Output:
[kotlin2js] logging: compiling source files: [TestData]/root1/foo.kt
[kotlin2js] output: output:
[kotlin2js] [Temp]/out.js
[kotlin2js] Sources:
[kotlin2js] [TestData]/root1/foo.kt
@@ -3,7 +3,7 @@ Buildfile: [TestData]/build.xml
build:
[kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
[kotlin2js] INFO: Kotlin Compiler version [KotlinVersion]
[kotlin2js] info: Kotlin Compiler version [KotlinVersion]
BUILD SUCCESSFUL
Total time: [time]
@@ -5,7 +5,7 @@ build:
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
[javac] Compiling 1 source file to [Temp]
[javac] Compiling [[TestData]] => [[Temp]]
[javac] INFO: Kotlin Compiler version [KotlinVersion]
[javac] info: Kotlin Compiler version [KotlinVersion]
[javac] Running javac...
BUILD SUCCESSFUL
@@ -4,13 +4,25 @@ Buildfile: [TestData]/build.xml
build:
[javac] Compiling 2 source files to [Temp]
[javac] Compiling [[TestData]] => [[Temp]]
[javac] ERROR: [TestData]/incorrectKotlinCode.kt: (4, 1) Parameter name expected
[javac] ERROR: [TestData]/incorrectKotlinCode.kt: (4, 1) Expecting comma or ')'
[javac] ERROR: [TestData]/incorrectKotlinCode.kt: (4, 1) Expecting ')'
[javac] [TestData]/incorrectKotlinCode.kt:4:1: error: parameter name expected
[javac]
[javac] ^
[javac] [TestData]/incorrectKotlinCode.kt:4:1: error: expecting comma or ')'
[javac]
[javac] ^
[javac] [TestData]/incorrectKotlinCode.kt:4:1: error: expecting ')'
[javac]
[javac] ^
[kotlinc] Compiling [[TestData]] => [[Temp]]
[kotlinc] ERROR: [TestData]/incorrectKotlinCode.kt: (4, 1) Parameter name expected
[kotlinc] ERROR: [TestData]/incorrectKotlinCode.kt: (4, 1) Expecting comma or ')'
[kotlinc] ERROR: [TestData]/incorrectKotlinCode.kt: (4, 1) Expecting ')'
[kotlinc] [TestData]/incorrectKotlinCode.kt:4:1: error: parameter name expected
[kotlinc]
[kotlinc] ^
[kotlinc] [TestData]/incorrectKotlinCode.kt:4:1: error: expecting comma or ')'
[kotlinc]
[kotlinc] ^
[kotlinc] [TestData]/incorrectKotlinCode.kt:4:1: error: expecting ')'
[kotlinc]
[kotlinc] ^
BUILD SUCCESSFUL
Total time: [time]
@@ -3,7 +3,9 @@ Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
[kotlinc] WARNING: [TestData]/hello.kt: (15, 9) Variable 'result' is never used
[kotlinc] [TestData]/hello.kt:15:9: warning: variable 'result' is never used
[kotlinc] val result = "$a$c$e$f$j"
[kotlinc] ^
[java] OK
BUILD SUCCESSFUL
@@ -3,8 +3,8 @@ Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
[kotlinc] LOGGING: Using Kotlin home directory [KotlinProjectHome]/dist/kotlinc
[kotlinc] LOGGING: Configuring the compilation environment
[kotlinc] logging: using Kotlin home directory [KotlinProjectHome]/dist/kotlinc
[kotlinc] logging: configuring the compilation environment
BUILD SUCCESSFUL
Total time: [time]
@@ -3,7 +3,7 @@ Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
[kotlinc] INFO: Kotlin Compiler version [KotlinVersion]
[kotlinc] info: Kotlin Compiler version [KotlinVersion]
BUILD SUCCESSFUL
Total time: [time]
@@ -1,5 +1,7 @@
ERR:
ERROR: hello.kt: (4, 5) Unresolved reference: a
hello.kt:4:5: error: unresolved reference: a
a
^
Return code: 1
@@ -1,5 +1,7 @@
ERR:
ERROR: test.kt: (4, 20) Expecting an element
test.kt:4:20: error: expecting an element
val s = System.in
^
Return code: 1