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:
committed by
Ilya Gorbunov
parent
897261a8a6
commit
5cbcbe4a9c
+1
@@ -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
|
||||
|
||||
Vendored
+1
@@ -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
|
||||
|
||||
Vendored
+1
@@ -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
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/werror.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Werror
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
fun foo(s: String, t: String?) {
|
||||
s!!
|
||||
t?.toString()
|
||||
}
|
||||
Vendored
+5
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo(s: String, t: String?) {
|
||||
s!!
|
||||
t?.toString()
|
||||
t.length
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/werrorWithNoWarn.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Werror
|
||||
-nowarn
|
||||
@@ -0,0 +1,4 @@
|
||||
fun foo(s: String, t: String?) {
|
||||
s!!
|
||||
t?.toString()
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
fun foo(s: String, t: String?) {
|
||||
s!!
|
||||
t?.toString()
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user