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,18 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
inline fun foo() {
|
||||
try {
|
||||
try {
|
||||
throw Exception("XXX")
|
||||
} catch (e: Throwable) {
|
||||
println("Gotcha1: ${e.message}")
|
||||
throw Exception("YYY")
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
println("Gotcha2: ${e.message}")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
inline fun foo(x: Char = '\u042b') = x
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
inline val Int.prop get() = SomeDataClass(second = this)
|
||||
|
||||
data class SomeDataClass(val first: Int = 17, val second: Int = 19, val third: Int = 23)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import foo.bar.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val c = C()
|
||||
val d = C.D()
|
||||
val e = C.D.E()
|
||||
c.foo()
|
||||
d.foo()
|
||||
e.foo()
|
||||
|
||||
val c2 = C2()
|
||||
val d2 = C2().D2()
|
||||
val e2 = C2().D2().E2()
|
||||
c2.foo()
|
||||
d2.foo()
|
||||
e2.foo()
|
||||
|
||||
val c3 = C3<Int>()
|
||||
val d3 = C3.D3<String>()
|
||||
val e3 = C3.D3.E3<Float>()
|
||||
c3.foo(13)
|
||||
d3.foo("cha-cha-cha")
|
||||
e3.foo(1.0f)
|
||||
|
||||
// This part doesn't work with file local inline functions.
|
||||
// So disabled for now.
|
||||
// val c4 = C4<Int>()
|
||||
// val d4 = C4<String>().D4<Int>()
|
||||
// val e4 = C4<Int>().D4<String>().E4<Int>()
|
||||
// c4.foo(13)
|
||||
// d4.foo("cawabunga", 17)
|
||||
// e4.foo(19, "raqa-taqa", 23)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 serialization.deserialized_inline0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
fun inline_todo() {
|
||||
try {
|
||||
TODO("OK")
|
||||
} catch (e: Throwable) {
|
||||
println(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
fun inline_maxof() {
|
||||
println(maxOf(10, 17))
|
||||
println(maxOf(17, 13))
|
||||
println(maxOf(17, 17))
|
||||
}
|
||||
|
||||
fun inline_assert() {
|
||||
//assert(true)
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
inline_todo()
|
||||
inline_assert()
|
||||
inline_maxof()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 serialization.deserialized_listof0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun test_arrayList() {
|
||||
val l = listOf(1, 2, 3)
|
||||
val m = listOf<Int>()
|
||||
val n = l + m
|
||||
println(n)
|
||||
}
|
||||
|
||||
fun <T> test_arrayList2(x: T, y: T, z: T) {
|
||||
val l = listOf<T>(x, y, z)
|
||||
val m = listOf<T>()
|
||||
val n = m + l
|
||||
println(l)
|
||||
}
|
||||
|
||||
fun test_arrayList3() {
|
||||
val l = listOf<String>()
|
||||
val m = listOf<String>("a", "b", "c")
|
||||
val n = l + m
|
||||
println(n)
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
test_arrayList()
|
||||
test_arrayList2<Int>(5, 6, 7)
|
||||
test_arrayList2<String>("a", "b", "c")
|
||||
test_arrayList3()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
inline fun foo() {
|
||||
do {
|
||||
var x: Int = 999
|
||||
println(x)
|
||||
} while (x != 999)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
enum class Color {
|
||||
RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW
|
||||
}
|
||||
|
||||
fun determineColor(code: Int): Color = when (code) {
|
||||
0 -> Color.BLUE
|
||||
1 -> Color.MAGENTA
|
||||
else -> Color.CYAN
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println(Color.RED.ordinal)
|
||||
println(Color.GREEN.ordinal)
|
||||
println(Color.BLUE.ordinal)
|
||||
val color = when (determineColor(args.size)) {
|
||||
Color.RED -> println("r")
|
||||
Color.GREEN -> println("g")
|
||||
Color.BLUE -> println("b")
|
||||
Color.CYAN -> println("c")
|
||||
Color.MAGENTA -> println("m")
|
||||
Color.YELLOW -> println("y")
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println(666.prop)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
fun main(args: Array<String>) {
|
||||
memScoped {
|
||||
val bufferLength = 100L
|
||||
val buffer = allocArray<ByteVar>(bufferLength)
|
||||
}
|
||||
println("OK")
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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 foo.bar
|
||||
|
||||
class R<T> {
|
||||
inline fun bar(t: T) {
|
||||
println("just a single class: $t")
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
inline fun foo() {
|
||||
println("first level")
|
||||
}
|
||||
|
||||
class D {
|
||||
inline fun foo() {
|
||||
println("second level")
|
||||
}
|
||||
|
||||
class E {
|
||||
inline fun foo() {
|
||||
println("third levelxz")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class C2 {
|
||||
inline fun foo() {
|
||||
println("inner first level")
|
||||
}
|
||||
|
||||
inner class D2 {
|
||||
inline fun foo() {
|
||||
println("inner second level")
|
||||
}
|
||||
|
||||
inner class E2 {
|
||||
inline fun foo() {
|
||||
println("inner third level")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class C3<X> {
|
||||
inline fun foo(x: X) {
|
||||
println("types first level: $x")
|
||||
}
|
||||
|
||||
class D3<X> {
|
||||
inline fun foo(x: X) {
|
||||
println("types second level $x")
|
||||
}
|
||||
|
||||
class E3<X> {
|
||||
inline fun foo(x: X) {
|
||||
println("types third level $x")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class C4<X> {
|
||||
inline fun foo(x: X) {
|
||||
println("inner types first level: $x")
|
||||
}
|
||||
|
||||
inner class D4<Y> {
|
||||
inline fun foo(x: X, y: Y) {
|
||||
println("inner types second level $x, $y")
|
||||
}
|
||||
|
||||
inner class E4<Z> {
|
||||
inline fun foo(x: X, y: Y, z: Z) {
|
||||
println("inner types third level $x, $y, $z")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
foo()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println(foo())
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
fun bar(vararg x: Int) {
|
||||
x.forEach {
|
||||
println(it)
|
||||
}
|
||||
println("size: ${x.size}")
|
||||
}
|
||||
|
||||
inline fun foo() = bar(17, 19, 23, *intArrayOf(29, 31))
|
||||
|
||||
Reference in New Issue
Block a user