Support -Werror CLI argument to treat warnings as errors

The option is named "warningsAsErrors" in the Gradle plugin

 #KT-10563 Fixed
This commit is contained in:
Alexander Udalov
2017-08-25 17:11:34 +03:00
committed by Ilya Gorbunov
parent 897261a8a6
commit 5cbcbe4a9c
26 changed files with 133 additions and 9 deletions
+1
View File
@@ -8,4 +8,5 @@ where possible options include:
-nowarn Generate no warnings
-verbose Enable verbose logging output
-version Display compiler version
-Werror Report an error if there are any warnings
OK
+1
View File
@@ -25,4 +25,5 @@ where possible options include:
-nowarn Generate no warnings
-verbose Enable verbose logging output
-version Display compiler version
-Werror Report an error if there are any warnings
OK
+1
View File
@@ -23,4 +23,5 @@ where possible options include:
-nowarn Generate no warnings
-verbose Enable verbose logging output
-version Display compiler version
-Werror Report an error if there are any warnings
OK
+4
View File
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/werror.kt
-d
$TEMP_DIR$
-Werror
+4
View File
@@ -0,0 +1,4 @@
fun foo(s: String, t: String?) {
s!!
t?.toString()
}
+5
View File
@@ -0,0 +1,5 @@
error: warnings found and -Werror specified
compiler/testData/cli/jvm/werror.kt:2:6: warning: unnecessary non-null assertion (!!) on a non-null receiver of type String
s!!
^
COMPILATION_ERROR
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/werrorWithExplicitError.kt
-d
$TEMP_DIR$
-Werror
+5
View File
@@ -0,0 +1,5 @@
fun foo(s: String, t: String?) {
s!!
t?.toString()
t.length
}
+4
View File
@@ -0,0 +1,4 @@
compiler/testData/cli/jvm/werrorWithExplicitError.kt:4:6: error: only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
t.length
^
COMPILATION_ERROR
+5
View File
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/werrorWithNoWarn.kt
-d
$TEMP_DIR$
-Werror
-nowarn
+4
View File
@@ -0,0 +1,4 @@
fun foo(s: String, t: String?) {
s!!
t?.toString()
}
+5
View File
@@ -0,0 +1,5 @@
error: warnings found and -Werror specified
compiler/testData/cli/jvm/werrorWithNoWarn.kt:2:6: warning: unnecessary non-null assertion (!!) on a non-null receiver of type String
s!!
^
COMPILATION_ERROR
@@ -0,0 +1,6 @@
$TESTDATA_DIR$/werrorWithStrongWarning.kt
-d
$TEMP_DIR$
-Werror
-cp
non-existing-path.jar
+4
View File
@@ -0,0 +1,4 @@
fun foo(s: String, t: String?) {
s!!
t?.toString()
}
+3
View File
@@ -0,0 +1,3 @@
warning: classpath entry points to a non-existent location: non-existing-path.jar
error: warnings found and -Werror specified
COMPILATION_ERROR