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:
Stanislav Erokhin
2020-10-27 21:00:28 +03:00
parent 91e4162dad
commit f624800b84
2830 changed files with 0 additions and 0 deletions
@@ -0,0 +1,61 @@
/*
* 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.controlflow.`break`
import kotlin.test.*
fun foo() {
var i = 0
l1@while (true) {
println("foo@l1")
try {
l2@while (true) {
if ((i++ % 2) == 0) continue@l2
println("foo@l2")
if (i > 4) break@l1
}
} finally {
}
}
}
fun bar() {
var i = 0
l1@do {
try {
println("bar@l1")
throw Exception()
} catch (e: Exception) {
l2@do {
if ((i++ % 2) == 0) continue@l2
println("bar@l2")
if (i > 4) break@l1
} while (true)
}
} while (true)
}
fun qux() {
l1@for (i in 1..6) {
t1@try {
println("qux@t1")
throw Exception()
}
finally {
l2@ for (j in 1..6) {
if ((j % 2) == 0) continue@l2
println("qux@l2")
if (j > 4) break@l1
}
}
}
}
@Test fun runTest() {
foo()
bar()
qux()
}
@@ -0,0 +1,16 @@
/*
* 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.controlflow.break1
import kotlin.test.*
@Test fun runTest() {
loop@ while (true) {
println("Body")
break
}
println("Done")
}
@@ -0,0 +1,83 @@
/*
* 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.controlflow.for_loops
import kotlin.test.*
@Test fun runTest() {
// Simple loops
for (i in 0..4) {
print(i)
}
println()
for (i in 0 until 4) {
print(i)
}
println()
for (i in 4 downTo 0) {
print(i)
}
println()
println()
// Steps
for (i in 0..4 step 2) {
print(i)
}
println()
for (i in 0 until 4 step 2) {
print(i)
}
println()
for (i in 4 downTo 0 step 2) {
print(i)
}
println()
println()
// Two steps
for (i in 0..6 step 2 step 3) {
print(i)
}
println()
for (i in 0 until 6 step 2 step 3) {
print(i)
}
println()
for (i in 6 downTo 0 step 2 step 3) {
print(i)
}
println()
println()
// Without constants
val a = 0
val b = 4
val s = 2
for (i in a..b step s) {
print(i)
}
println()
for (i in a until b step s) {
print(i)
}
println()
for (i in b downTo a step s) {
print(i)
}
println()
println()
}
@@ -0,0 +1,40 @@
package codegen.controlflow.for_loops_array
import kotlin.test.*
fun <T : ByteArray> genericArray(data : T): Int {
var sum = 0
for (element in data) {
sum += element
}
return sum
}
fun IntArray.sum(): Int {
var sum = 0
for (element in this) {
sum += element
}
return sum
}
@Test fun runTest() {
val intArray = intArrayOf(4, 0, 3, 5)
val emptyArray = arrayOf<Any>()
for (element in intArray) {
print(element)
}
println()
for (element in emptyArray) {
print(element)
}
println()
val byteArray = byteArrayOf(1, -1)
println(genericArray(byteArray))
val fives = intArrayOf(5, 5, 5, -5, -5, -5)
println(fives.sum())
}
@@ -0,0 +1,21 @@
package codegen.controlflow.for_loops_array_break_continue
import kotlin.test.*
@Test fun runTest() {
val intArray = intArrayOf(4, 0, 3, 5)
val emptyArray = arrayOf<Any>()
for (element in intArray) {
print(element)
if (element == 3) {
break
}
}
println()
for (element in emptyArray) {
print(element)
}
println()
}
@@ -0,0 +1,18 @@
package codegen.controlflow.for_loops_array_indices
import kotlin.test.*
@Test fun runTest() {
val intArray = intArrayOf(4, 0, 3, 5)
val emptyArray = arrayOf<Any>()
for (index in intArray.indices) {
print(index)
}
println()
for (index in emptyArray.indices) {
print(index)
}
println()
}
@@ -0,0 +1,13 @@
package codegen.controlflow.for_loops_array_mutation
import kotlin.test.*
@Test fun runTest() {
val intArray = arrayOf(4, 0, 3, 5)
for (element in intArray) {
intArray[2] = 0
intArray[3] = 0
print(element)
}
}
@@ -0,0 +1,25 @@
package codegen.controlflow.for_loops_array_nested
import kotlin.test.*
@Test fun arrayOfArrays() {
val metaArray = arrayOf(
arrayOf(1, 2, 3),
arrayOf("Hello"),
arrayOf<Any>(),
arrayOf(1..10)
)
for (array in metaArray) {
inner@for (elem in array) {
if (elem is IntProgression) {
for (i in elem) {
print(i)
}
continue@inner
} else {
print(elem)
}
}
println()
}
}
@@ -0,0 +1,16 @@
package codegen.controlflow.for_loops_array_nullable
import kotlin.test.*
private fun nullableArray(a: Array<Int>): Array<Int>? {
return a
}
@Test fun nullable() {
val array = arrayOf(1, 2, 3)
nullableArray(array)?.let {
for (elem in it) {
print(elem)
}
}
}
@@ -0,0 +1,23 @@
package codegen.controlflow.for_loops_array_side_effects
import kotlin.test.*
private fun <T> sideEffect(array: T): T {
println("side-effect")
return array
}
@Test fun runTest() {
val intArray = intArrayOf(4, 0, 3, 5)
val emptyArray = arrayOf<Any>()
for (element in sideEffect(intArray)) {
print(element)
}
println()
for (element in sideEffect(emptyArray)) {
print(element)
}
println()
}
@@ -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.controlflow.for_loops_call_order
import kotlin.test.*
fun f1(): Int { print("1"); return 0 }
fun f2(): Int { print("2"); return 6 }
fun f3(): Int { print("3"); return 2 }
fun f4(): Int { print("4"); return 3 }
@Test fun runTest() {
for (i in f1()..f2() step f3() step f4()) { }; println()
for (i in f1() until f2() step f3() step f4()) {}; println()
for (i in f2() downTo f1() step f3() step f4()) {}; println()
}
@@ -0,0 +1,21 @@
/*
* 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.controlflow.for_loops_coroutines
import kotlin.test.*
import kotlin.coroutines.*
@Test fun runTest() {
val sq = sequence {
for (i in 0..6 step 2) {
print("before: $i ")
yield(i)
println("after: $i")
}
}
println("Got: ${sq.joinToString(separator = " ")}")
}
@@ -0,0 +1,25 @@
/*
* 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.controlflow.for_loops_empty_range
import kotlin.test.*
@Test fun runTest() {
// Simple loops
for (i in 4..0) { print(i) }
for (i in 4 until 0) { print(i) }
for (i in 0 downTo 4) { print(i) }
// Steps
for (i in 4..0 step 2) { print(i) }
for (i in 4 until 0 step 2) { print(i) }
for (i in 0 downTo 4 step 2) { print(i) }
// Two steps
for (i in 6..0 step 2 step 3) { print(i) }
for (i in 6 until 0 step 2 step 3) { print(i) }
for (i in 0 downTo 6 step 2 step 3) { print(i) }
println("OK")
}
@@ -0,0 +1,60 @@
/*
* 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.controlflow.for_loops_errors
import kotlin.test.*
@Test fun runTest() {
// Negative step.
try {
for (i in 0 .. 4 step -2) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
try {
for (i in 0 until 4 step -2) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
try {
for (i in 4 downTo 0 step -2) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
// Zero step.
try {
for (i in 0 .. 4 step 0) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
try {
for (i in 0 until 4 step 0) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
try {
for (i in 4 downTo 0 step 0) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
// Two steps, one is negative.
try {
for (i in 0 .. 4 step -2 step 3) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
try {
for (i in 0 until 4 step -2 step 3) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
try {
for (i in 4 downTo 0 step -2 step 3) print(i); println()
throw AssertionError()
} catch (e: IllegalArgumentException) {}
println("OK")
}
@@ -0,0 +1,156 @@
/*
* 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.controlflow.for_loops_let_with_nullable
import kotlin.test.*
// Github issue #1012
fun testInt(left: Int?, right: Int?, step: Int?) {
right?.let {
for (i in 0..it) { print(i) }
}
println()
left?.let {
for (i in it..5) { print(i) }
}
println()
step?.let {
for (i in 0..5 step it) { print(i) }
}
println()
right?.let {
for (i in 0 until it) { print(i) }
}
println()
left?.let {
for (i in it until 5) { print(i) }
}
println()
step?.let {
for (i in 0 until 5 step it) { print(i) }
}
println()
right?.let {
for (i in it downTo 0) { print(i) }
}
println()
left?.let {
for (i in 5 downTo it) { print(i) }
}
println()
step?.let {
for (i in 5 downTo 0 step it) { print(i) }
}
println()
}
fun testLong(left: Long?, right: Long?, step: Long?) {
right?.let {
for (i in 0..it) { print(i) }
}
println()
left?.let {
for (i in it..5) { print(i) }
}
println()
step?.let {
for (i in 0..5L step it) { print(i) }
}
println()
right?.let {
for (i in 0 until it) { print(i) }
}
println()
left?.let {
for (i in it until 5) { print(i) }
}
println()
step?.let {
for (i in 0 until 5L step it) { print(i) }
}
println()
right?.let {
for (i in it downTo 0) { print(i) }
}
println()
left?.let {
for (i in 5 downTo it) { print(i) }
}
println()
step?.let {
for (i in 5 downTo 0L step it) { print(i) }
}
println()
}
fun testChar(left: Char?, right: Char?, step: Int?) {
right?.let {
for (i in 'a'..it) { print(i) }
}
println()
left?.let {
for (i in it..'f') { print(i) }
}
println()
step?.let {
for (i in 'a'..'f' step it) { print(i) }
}
println()
right?.let {
for (i in 'a' until it) { print(i) }
}
println()
left?.let {
for (i in it until 'f') { print(i) }
}
println()
step?.let {
for (i in 'a' until 'f' step it) { print(i) }
}
println()
right?.let {
for (i in it downTo 'a') { print(i) }
}
println()
left?.let {
for (i in 'f' downTo it) { print(i) }
}
println()
step?.let {
for (i in 'f' downTo 'a' step it) { print(i) }
}
println()
}
@Test fun runTest() {
testInt(0, 5, 2)
testLong(0, 5, 2)
testChar('a', 'f', 2)
}
@@ -0,0 +1,68 @@
/*
* 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.controlflow.for_loops_nested
import kotlin.test.*
@Test fun runTest() {
// Simple
for (i in 0..2) {
for (j in 0..2) {
print("$i$j ")
}
}
println()
// Break
l1@for (i in 0..2) {
l2@for (j in 0..2) {
print("$i$j ")
if (j == 1) break
}
}
println()
l1@for (i in 0..2) {
l2@for (j in 0..2) {
print("$i$j ")
if (j == 1) break@l2
}
}
println()
l1@for (i in 0..2) {
l2@for (j in 0..2) {
print("$i$j ")
if (j == 1) break@l1
}
}
println()
// Continue
l1@for (i in 0..2) {
l2@for (j in 0..2) {
if (j == 1) continue
print("$i$j ")
}
}
println()
l1@for (i in 0..2) {
l2@for (j in 0..2) {
if (j == 1) continue@l2
print("$i$j ")
}
}
println()
l1@for (i in 0..2) {
l2@for (j in 0..2) {
if (j == 1) continue@l1
print("$i$j ")
}
}
println()
}
@@ -0,0 +1,31 @@
/*
* 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.controlflow.for_loops_overflow
import kotlin.test.*
@Test fun runTest() {
for (i in Int.MAX_VALUE - 1 .. Int.MAX_VALUE) { print(i); print(' ') }; println()
for (i in Int.MAX_VALUE - 1 until Int.MAX_VALUE) { print(i); print(' ') }; println()
for (i in Int.MIN_VALUE + 1 downTo Int.MIN_VALUE) { print(i); print(' ') }; println()
// Empty loops
for (i in Byte.MIN_VALUE until Byte.MIN_VALUE) { print(i); print(' ') }
for (i in Short.MIN_VALUE until Short.MIN_VALUE) { print(i); print(' ') }
for (i in Int.MIN_VALUE until Int.MIN_VALUE) { print(i); print(' ') }
for (i in Long.MIN_VALUE until Long.MIN_VALUE) { print(i); print(' ') }
for (i in 0.toChar() until 0.toChar()) { print(i); print(' ') }
for (i in 0 until Byte.MIN_VALUE) { print(i); print(' ') }
for (i in 0 until Short.MIN_VALUE) { print(i); print(' ') }
for (i in 0 until Int.MIN_VALUE) { print(i); print(' ') }
for (i in 0 until Long.MIN_VALUE) { print(i); print(' ') }
for (i in 'a' until 0.toChar()) { print(i); print(' ') }
val M = Int.MAX_VALUE / 2
for (i in M + 4..M + 10 step M) { print(i); print(' ') }; println()
}
@@ -0,0 +1,114 @@
/*
* 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.controlflow.for_loops_types
import kotlin.test.*
@Test fun runTest() {
for (i in 0.toByte() .. 4.toByte()) print(i); println()
for (i in 0.toByte() .. 4.toShort()) print(i); println()
for (i in 0.toByte() .. 4.toInt()) print(i); println()
for (i in 0.toByte() .. 4.toLong()) print(i); println()
for (i in 0.toShort() .. 4.toByte()) print(i); println()
for (i in 0.toShort() .. 4.toShort()) print(i); println()
for (i in 0.toShort() .. 4.toInt()) print(i); println()
for (i in 0.toShort() .. 4.toLong()) print(i); println()
for (i in 0.toInt() .. 4.toByte()) print(i); println()
for (i in 0.toInt() .. 4.toShort()) print(i); println()
for (i in 0.toInt() .. 4.toInt()) print(i); println()
for (i in 0.toInt() .. 4.toLong()) print(i); println()
for (i in 0.toLong() .. 4.toByte()) print(i); println()
for (i in 0.toLong() .. 4.toShort()) print(i); println()
for (i in 0.toLong() .. 4.toInt()) print(i); println()
for (i in 0.toLong() .. 4.toLong()) print(i); println()
for (i in 0.toByte() until 4.toByte()) print(i); println()
for (i in 0.toByte() until 4.toShort()) print(i); println()
for (i in 0.toByte() until 4.toInt()) print(i); println()
for (i in 0.toByte() until 4.toLong()) print(i); println()
for (i in 0.toShort() until 4.toByte()) print(i); println()
for (i in 0.toShort() until 4.toShort()) print(i); println()
for (i in 0.toShort() until 4.toInt()) print(i); println()
for (i in 0.toShort() until 4.toLong()) print(i); println()
for (i in 0.toInt() until 4.toByte()) print(i); println()
for (i in 0.toInt() until 4.toShort()) print(i); println()
for (i in 0.toInt() until 4.toInt()) print(i); println()
for (i in 0.toInt() until 4.toLong()) print(i); println()
for (i in 0.toLong() until 4.toByte()) print(i); println()
for (i in 0.toLong() until 4.toShort()) print(i); println()
for (i in 0.toLong() until 4.toInt()) print(i); println()
for (i in 0.toLong() until 4.toLong()) print(i); println()
for (i in 4.toByte() downTo 0.toByte()) print(i); println()
for (i in 4.toByte() downTo 0.toShort()) print(i); println()
for (i in 4.toByte() downTo 0.toInt()) print(i); println()
for (i in 4.toByte() downTo 0.toLong()) print(i); println()
for (i in 4.toShort() downTo 0.toByte()) print(i); println()
for (i in 4.toShort() downTo 0.toShort()) print(i); println()
for (i in 4.toShort() downTo 0.toInt()) print(i); println()
for (i in 4.toShort() downTo 0.toLong()) print(i); println()
for (i in 4.toInt() downTo 0.toByte()) print(i); println()
for (i in 4.toInt() downTo 0.toShort()) print(i); println()
for (i in 4.toInt() downTo 0.toInt()) print(i); println()
for (i in 4.toInt() downTo 0.toLong()) print(i); println()
for (i in 4.toLong() downTo 0.toByte()) print(i); println()
for (i in 4.toLong() downTo 0.toShort()) print(i); println()
for (i in 4.toLong() downTo 0.toInt()) print(i); println()
for (i in 4.toLong() downTo 0.toLong()) print(i); println()
for (i in 'a' .. 'd') print(i); println()
for (i in 'a' until 'd') print(i); println()
for (i in 'd' downTo 'a') print(i); println()
for (i in 0.toByte() .. 4.toByte() step 2) print(i); println()
for (i in 0.toByte() .. 4.toShort() step 2) print(i); println()
for (i in 0.toByte() .. 4.toInt() step 2) print(i); println()
for (i in 0.toByte() .. 4.toLong() step 2L) print(i); println()
for (i in 0.toShort() .. 4.toByte() step 2) print(i); println()
for (i in 0.toShort() .. 4.toShort() step 2) print(i); println()
for (i in 0.toShort() .. 4.toInt() step 2) print(i); println()
for (i in 0.toShort() .. 4.toLong() step 2L) print(i); println()
for (i in 0.toInt() .. 4.toByte() step 2) print(i); println()
for (i in 0.toInt() .. 4.toShort() step 2) print(i); println()
for (i in 0.toInt() .. 4.toInt() step 2) print(i); println()
for (i in 0.toInt() .. 4.toLong() step 2L) print(i); println()
for (i in 0.toLong() .. 4.toByte() step 2L) print(i); println()
for (i in 0.toLong() .. 4.toShort() step 2L) print(i); println()
for (i in 0.toLong() .. 4.toInt() step 2L) print(i); println()
for (i in 0.toLong() .. 4.toLong() step 2L) print(i); println()
for (i in 0.toByte() until 4.toByte() step 2) print(i); println()
for (i in 0.toByte() until 4.toShort() step 2) print(i); println()
for (i in 0.toByte() until 4.toInt() step 2) print(i); println()
for (i in 0.toByte() until 4.toLong() step 2L) print(i); println()
for (i in 0.toShort() until 4.toByte() step 2) print(i); println()
for (i in 0.toShort() until 4.toShort() step 2) print(i); println()
for (i in 0.toShort() until 4.toInt() step 2) print(i); println()
for (i in 0.toShort() until 4.toLong() step 2L) print(i); println()
for (i in 0.toInt() until 4.toByte() step 2) print(i); println()
for (i in 0.toInt() until 4.toShort() step 2) print(i); println()
for (i in 0.toInt() until 4.toInt() step 2) print(i); println()
for (i in 0.toInt() until 4.toLong() step 2L) print(i); println()
for (i in 0.toLong() until 4.toByte() step 2L) print(i); println()
for (i in 0.toLong() until 4.toShort() step 2L) print(i); println()
for (i in 0.toLong() until 4.toInt() step 2L) print(i); println()
for (i in 0.toLong() until 4.toLong() step 2L) print(i); println()
for (i in 4.toByte() downTo 0.toByte() step 2) print(i); println()
for (i in 4.toByte() downTo 0.toShort() step 2) print(i); println()
for (i in 4.toByte() downTo 0.toInt() step 2) print(i); println()
for (i in 4.toByte() downTo 0.toLong() step 2L) print(i); println()
for (i in 4.toShort() downTo 0.toByte() step 2) print(i); println()
for (i in 4.toShort() downTo 0.toShort() step 2) print(i); println()
for (i in 4.toShort() downTo 0.toInt() step 2) print(i); println()
for (i in 4.toShort() downTo 0.toLong() step 2L) print(i); println()
for (i in 4.toInt() downTo 0.toByte() step 2) print(i); println()
for (i in 4.toInt() downTo 0.toShort() step 2) print(i); println()
for (i in 4.toInt() downTo 0.toInt() step 2) print(i); println()
for (i in 4.toInt() downTo 0.toLong() step 2L) print(i); println()
for (i in 4.toLong() downTo 0.toByte() step 2L) print(i); println()
for (i in 4.toLong() downTo 0.toShort() step 2L) print(i); println()
for (i in 4.toLong() downTo 0.toInt() step 2L) print(i); println()
for (i in 4.toLong() downTo 0.toLong() step 2L) print(i); println()
for (i in 'a' .. 'd' step 2) print(i); println()
for (i in 'a' until 'd' step 2) print(i); println()
for (i in 'd' downTo 'a' step 2) print(i); println()
}
@@ -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.controlflow.unreachable1
import kotlin.test.*
@Test fun runTest() {
println(foo())
}
fun foo(): Int {
return 1
println("After return")
}