From e4b70e77888b70d4219663f4f88f1b9c4f0132c0 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 15 Sep 2023 16:53:04 +0200 Subject: [PATCH] LV 2.0: update some CLI tests with warnings to use DIVISION_BY_ZERO warning --- .../appendingArgs.kt | 4 ++-- .../appendingArgs.out | 3 +++ compiler/testData/cli/jvm/werror.args | 1 - compiler/testData/cli/jvm/werror.kt | 6 +++--- compiler/testData/cli/jvm/werror.out | 18 ++++++------------ .../testData/cli/jvm/werrorWithNoWarn.args | 3 +-- compiler/testData/cli/jvm/werrorWithNoWarn.kt | 4 ---- compiler/testData/cli/jvm/werrorWithNoWarn.out | 18 ++++++------------ .../cli/jvm/werrorWithStrongWarning.args | 2 +- .../cli/jvm/werrorWithStrongWarning.kt | 4 ---- 10 files changed, 22 insertions(+), 41 deletions(-) delete mode 100644 compiler/testData/cli/jvm/werrorWithNoWarn.kt delete mode 100644 compiler/testData/cli/jvm/werrorWithStrongWarning.kt diff --git a/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt b/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt index f6e91613180..7843d5ed86f 100644 --- a/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt +++ b/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt @@ -1,5 +1,5 @@ package kotlin -fun main() { - val x = 1?.dec() +fun foo(arg: Int) { + val x = arg / 0 } diff --git a/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.out b/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.out index d86bac9de59..90532808d90 100644 --- a/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.out +++ b/compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.out @@ -1 +1,4 @@ +compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt:4:13: warning: [DIVISION_BY_ZERO] Division by zero. + val x = arg / 0 + ^ OK diff --git a/compiler/testData/cli/jvm/werror.args b/compiler/testData/cli/jvm/werror.args index 83b70de8f40..52c71c79b17 100644 --- a/compiler/testData/cli/jvm/werror.args +++ b/compiler/testData/cli/jvm/werror.args @@ -1,5 +1,4 @@ $TESTDATA_DIR$/werror.kt -d $TEMP_DIR$ --XXLanguage\:+EnableDfaWarningsInK2 -Werror diff --git a/compiler/testData/cli/jvm/werror.kt b/compiler/testData/cli/jvm/werror.kt index 0baba9dabb1..e9c5b3db4d5 100644 --- a/compiler/testData/cli/jvm/werror.kt +++ b/compiler/testData/cli/jvm/werror.kt @@ -1,4 +1,4 @@ -fun foo(s: String, t: String?) { - s!! - t?.toString() +fun foo(a: Int, b: Int) { + println(a / 0) + println(b / 0) } diff --git a/compiler/testData/cli/jvm/werror.out b/compiler/testData/cli/jvm/werror.out index cdc5faeecaf..efb74bb7eba 100644 --- a/compiler/testData/cli/jvm/werror.out +++ b/compiler/testData/cli/jvm/werror.out @@ -1,14 +1,8 @@ -warning: ATTENTION! -This build uses unsafe internal compiler arguments: - --XXLanguage:+EnableDfaWarningsInK2 - -This mode is not recommended for production use, -as no stability/compatibility guarantees are given on -compiler or generated code. Use it at your own risk! - 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 'kotlin/String'. - s!! - ^ +compiler/testData/cli/jvm/werror.kt:2:13: warning: division by zero. + println(a / 0) + ^ +compiler/testData/cli/jvm/werror.kt:3:13: warning: division by zero. + println(b / 0) + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/werrorWithNoWarn.args b/compiler/testData/cli/jvm/werrorWithNoWarn.args index 487ca9c4483..4f3232e45ea 100644 --- a/compiler/testData/cli/jvm/werrorWithNoWarn.args +++ b/compiler/testData/cli/jvm/werrorWithNoWarn.args @@ -1,6 +1,5 @@ -$TESTDATA_DIR$/werrorWithNoWarn.kt +$TESTDATA_DIR$/werror.kt -d $TEMP_DIR$ --XXLanguage\:+EnableDfaWarningsInK2 -Werror -nowarn diff --git a/compiler/testData/cli/jvm/werrorWithNoWarn.kt b/compiler/testData/cli/jvm/werrorWithNoWarn.kt deleted file mode 100644 index 0baba9dabb1..00000000000 --- a/compiler/testData/cli/jvm/werrorWithNoWarn.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun foo(s: String, t: String?) { - s!! - t?.toString() -} diff --git a/compiler/testData/cli/jvm/werrorWithNoWarn.out b/compiler/testData/cli/jvm/werrorWithNoWarn.out index 348914a685d..efb74bb7eba 100644 --- a/compiler/testData/cli/jvm/werrorWithNoWarn.out +++ b/compiler/testData/cli/jvm/werrorWithNoWarn.out @@ -1,14 +1,8 @@ -warning: ATTENTION! -This build uses unsafe internal compiler arguments: - --XXLanguage:+EnableDfaWarningsInK2 - -This mode is not recommended for production use, -as no stability/compatibility guarantees are given on -compiler or generated code. Use it at your own risk! - 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 'kotlin/String'. - s!! - ^ +compiler/testData/cli/jvm/werror.kt:2:13: warning: division by zero. + println(a / 0) + ^ +compiler/testData/cli/jvm/werror.kt:3:13: warning: division by zero. + println(b / 0) + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/werrorWithStrongWarning.args b/compiler/testData/cli/jvm/werrorWithStrongWarning.args index 1094fce5de6..2d6dce666ff 100644 --- a/compiler/testData/cli/jvm/werrorWithStrongWarning.args +++ b/compiler/testData/cli/jvm/werrorWithStrongWarning.args @@ -1,4 +1,4 @@ -$TESTDATA_DIR$/werrorWithStrongWarning.kt +$TESTDATA_DIR$/werror.kt -Xdisable-default-scripting-plugin -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/werrorWithStrongWarning.kt b/compiler/testData/cli/jvm/werrorWithStrongWarning.kt deleted file mode 100644 index 0baba9dabb1..00000000000 --- a/compiler/testData/cli/jvm/werrorWithStrongWarning.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun foo(s: String, t: String?) { - s!! - t?.toString() -}