Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise they would be ignored according .gitignore settings. Probably they should be deleted from repo. Interop/.idea/compiler.xml Interop/.idea/gradle.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml Interop/.idea/modules.xml Interop/.idea/modules/Indexer/Indexer.iml Interop/.idea/modules/Runtime/Runtime.iml Interop/.idea/modules/StubGenerator/StubGenerator.iml backend.native/backend.native.iml backend.native/bc.frontend/bc.frontend.iml backend.native/cli.bc/cli.bc.iml backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt backend.native/tests/link/lib/foo.kt backend.native/tests/link/lib/foo2.kt backend.native/tests/teamcity-test.property
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.advanced_when2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun advanced_when2(i: Int): Int {
|
||||
var value = 1
|
||||
when (i) {
|
||||
10 -> {val v = 42; value = v}
|
||||
11 -> {val v = 43; value = v}
|
||||
12 -> {val v = 44; value = v}
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
if (advanced_when2(10) != 42) throw Error()
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.advanced_when5
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun advanced_when5(i: Int): Int {
|
||||
when (i) {
|
||||
0 -> { val v = 42; return v}
|
||||
1 -> { val v = 42; return v}
|
||||
2 -> { val v = 42; return v}
|
||||
3 -> { val v = 42; return v}
|
||||
4 -> { val v = 42; return v}
|
||||
else -> return 24
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
if (advanced_when5(5) != 24) throw Error()
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.if_else
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun if_else(b: Boolean): Int {
|
||||
if (b) return 42
|
||||
else return 24
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
if (if_else(false) != 24) throw Error()
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun when2(i: Int): Int {
|
||||
when (i) {
|
||||
0 -> return 42
|
||||
else -> return 24
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
if (when2(0) != 42) throw Error()
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when4
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun when5(i: Int): Int {
|
||||
when (i) {
|
||||
0 -> return 42
|
||||
1 -> return 4
|
||||
2 -> return 3
|
||||
3 -> return 2
|
||||
4 -> return 1
|
||||
}
|
||||
return 24
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when5
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun when5(i: Int): Int {
|
||||
when (i) {
|
||||
0 -> return 42
|
||||
1 -> return 4
|
||||
2 -> return 3
|
||||
3 -> return 2
|
||||
4 -> return 1
|
||||
else -> return 24
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
if (when5(2) != 3) throw Error()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when6
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
if (true) foo() else foo()
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when7
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
main(emptyArray())
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val b = args.size < 1
|
||||
val x = if (b) Any() else throw Error()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when8
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
when (true) {
|
||||
true -> println("true")
|
||||
false -> println("false")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when9
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
foo(0)
|
||||
println("Ok")
|
||||
}
|
||||
|
||||
fun foo(x: Int) {
|
||||
when (x) {
|
||||
0 -> 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when_through
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun when_through(i: Int): Int {
|
||||
var value = 1
|
||||
when (i) {
|
||||
10 -> value = 42
|
||||
11 -> value = 43
|
||||
12 -> value = 44
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
if (when_through(2) != 1) throw Error()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.branching.when_with_try1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
println(foo(Any()))
|
||||
println(foo("zzz"))
|
||||
println(foo("42"))
|
||||
}
|
||||
|
||||
fun foo(value: Any): Int? {
|
||||
if (value is CharSequence) {
|
||||
try {
|
||||
return value.toString().toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user