diff --git a/compiler/testData/launcher/funWithResultReturn.kts b/compiler/testData/launcher/funWithResultReturn.kts deleted file mode 100644 index 522a68b1285..00000000000 --- a/compiler/testData/launcher/funWithResultReturn.kts +++ /dev/null @@ -1,4 +0,0 @@ - -fun f() : Result = Result.success(42) - -println(f().getOrNull()) diff --git a/compiler/testData/launcher/funWithResultReturn.myscript b/compiler/testData/launcher/funWithResultReturn.myscript deleted file mode 100644 index 8d3bfa6d7e0..00000000000 --- a/compiler/testData/launcher/funWithResultReturn.myscript +++ /dev/null @@ -1,5 +0,0 @@ -@file:CompilerOptions("-Xallow-result-return-type") - -fun f() : Result = Result.success(42) - -println(f().getOrNull()) diff --git a/compiler/testData/launcher/noInline.kts b/compiler/testData/launcher/noInline.kts new file mode 100644 index 00000000000..450f23e4651 --- /dev/null +++ b/compiler/testData/launcher/noInline.kts @@ -0,0 +1 @@ +println("OK") \ No newline at end of file diff --git a/compiler/testData/launcher/noInline.myscript b/compiler/testData/launcher/noInline.myscript new file mode 100644 index 00000000000..a43038a58f8 --- /dev/null +++ b/compiler/testData/launcher/noInline.myscript @@ -0,0 +1,3 @@ +@file:CompilerOptions("-Xno-inline") + +println("OK") \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/cli/LauncherScriptTest.kt b/compiler/tests/org/jetbrains/kotlin/cli/LauncherScriptTest.kt index 583022af01b..745e7754daf 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/LauncherScriptTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/cli/LauncherScriptTest.kt @@ -239,7 +239,13 @@ class LauncherScriptTest : TestCaseWithTmpdir() { } fun testScriptWithXArguments() { - runProcess("kotlin", "-Xallow-result-return-type", "$testDataDirectory/funWithResultReturn.kts", expectedStdout = "42\n") + runProcess( + "kotlin", "-Xno-inline", "$testDataDirectory/noInline.kts", + expectedExitCode = 3, + expectedStderr = """java.lang.IllegalAccessError: tried to access method kotlin.io.ConsoleKt.println(Ljava/lang/Object;)V from class NoInline + at NoInline.(noInline.kts:1) +""") + runProcess("kotlin", "$testDataDirectory/noInline.kts", expectedStdout = "OK\n") } fun testNoStdLib() { @@ -292,17 +298,27 @@ println(42) fun testHowToRunCustomScript() { runProcess( - "kotlin", "$testDataDirectory/funWithResultReturn.myscript", - expectedExitCode = 1, expectedStderr = "error: could not find or load main class \$TESTDATA_DIR\$/funWithResultReturn.myscript\n" + "kotlin", "$testDataDirectory/noInline.myscript", + expectedExitCode = 1, expectedStderr = "error: could not find or load main class \$TESTDATA_DIR\$/noInline.myscript\n" ) runProcess( - "kotlin", "-howtorun", "script", "$testDataDirectory/funWithResultReturn.myscript", - expectedExitCode = 1, expectedStderr = "error: unrecognized script type: funWithResultReturn.myscript; Specify path to the script file as the first argument\n" + "kotlin", "-howtorun", "script", "$testDataDirectory/noInline.myscript", + expectedExitCode = 1, expectedStderr = "error: unrecognized script type: noInline.myscript; Specify path to the script file as the first argument\n" ) runProcess( - "kotlin", "-howtorun", ".main.kts", "$testDataDirectory/funWithResultReturn.myscript", - expectedStdout = "42\n" + "kotlin", "-howtorun", ".kts", "$testDataDirectory/noInline.myscript", + expectedExitCode = 1, expectedStderr = """error: unresolved reference: CompilerOptions (noInline.myscript:1:7) +compiler/testData/launcher/noInline.myscript:1:7: error: unresolved reference: CompilerOptions +@file:CompilerOptions("-Xno-inline") + ^ +""" ) + runProcess( + "kotlin", "-howtorun", ".main.kts", "$testDataDirectory/noInline.myscript", + expectedExitCode = 3, + expectedStderr = """java.lang.IllegalAccessError: tried to access method kotlin.io.ConsoleKt.println(Ljava/lang/Object;)V from class NoInline_main + at NoInline_main.(noInline.myscript:3) +""") } fun testHowToRunClassFile() {