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.
|
||||
*/
|
||||
|
||||
package codegen.lambda.lambda1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
run {
|
||||
println("lambda")
|
||||
}
|
||||
}
|
||||
|
||||
fun run(f: () -> Unit) {
|
||||
f()
|
||||
}
|
||||
@@ -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.lambda.lambda10
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
var str = "original"
|
||||
|
||||
val lambda = {
|
||||
println(str)
|
||||
}
|
||||
|
||||
lambda()
|
||||
|
||||
str = "changed"
|
||||
lambda()
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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.lambda.lambda11
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val first = "first"
|
||||
val second = "second"
|
||||
|
||||
run {
|
||||
println(first)
|
||||
println(second)
|
||||
}
|
||||
}
|
||||
|
||||
fun run(f: () -> Unit) {
|
||||
f()
|
||||
}
|
||||
@@ -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.lambda.lambda12
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val lambda = { s1: String, s2: String ->
|
||||
println(s1)
|
||||
println(s2)
|
||||
}
|
||||
|
||||
lambda("one", "two")
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
package codegen.lambda.lambda13
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
apply("foo") {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun apply(str: String, block: String.() -> Unit) {
|
||||
str.block()
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
package codegen.lambda.lambda14
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
assertEquals(foo()(), "foo1")
|
||||
assertEquals(foo(0)(), "foo2")
|
||||
}
|
||||
|
||||
fun foo() = { "foo1" }
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
package codegen.lambda.lambda14
|
||||
|
||||
fun foo(ignored: Int) = { "foo2" }
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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.lambda.lambda2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
main(arrayOf("arg0"))
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
run {
|
||||
println(args[0])
|
||||
}
|
||||
}
|
||||
|
||||
fun run(f: () -> Unit) {
|
||||
f()
|
||||
}
|
||||
@@ -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.lambda.lambda3
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
var str = "lambda"
|
||||
run {
|
||||
println(str)
|
||||
}
|
||||
}
|
||||
|
||||
fun run(f: () -> Unit) {
|
||||
f()
|
||||
}
|
||||
@@ -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 codegen.lambda.lambda4
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val lambda = bar()
|
||||
lambda()
|
||||
lambda()
|
||||
}
|
||||
|
||||
fun bar(): () -> Unit {
|
||||
var x = Integer(0)
|
||||
|
||||
val lambda = {
|
||||
println(x.toString())
|
||||
x = x + 1
|
||||
}
|
||||
|
||||
x = x + 1
|
||||
|
||||
lambda()
|
||||
lambda()
|
||||
|
||||
println(x.toString())
|
||||
|
||||
return lambda
|
||||
}
|
||||
|
||||
class Integer(val value: Int) {
|
||||
override fun toString() = value.toString()
|
||||
operator fun plus(other: Int) = Integer(value + other)
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
package codegen.lambda.lambda5
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
foo {
|
||||
println(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(f: (Int) -> Unit) {
|
||||
f(42)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.lambda.lambda6
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val str = "captured"
|
||||
foo {
|
||||
println(it)
|
||||
println(str)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(f: (Int) -> Unit) {
|
||||
f(42)
|
||||
}
|
||||
@@ -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.lambda.lambda7
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val x = foo {
|
||||
it + 1
|
||||
}
|
||||
println(x)
|
||||
}
|
||||
|
||||
fun foo(f: (Int) -> Int) = f(42)
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.lambda.lambda8
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val lambda1 = bar("first")
|
||||
val lambda2 = bar("second")
|
||||
|
||||
lambda1()
|
||||
lambda2()
|
||||
lambda1()
|
||||
lambda2()
|
||||
}
|
||||
|
||||
fun bar(str: String): () -> Unit {
|
||||
var x = Integer(0)
|
||||
|
||||
return {
|
||||
println(str)
|
||||
println(x.toString())
|
||||
x = x + 1
|
||||
}
|
||||
}
|
||||
|
||||
class Integer(val value: Int) {
|
||||
override fun toString() = value.toString()
|
||||
operator fun plus(other: Int) = Integer(value + other)
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.lambda.lambda9
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val lambdas = ArrayList<() -> Unit>()
|
||||
|
||||
for (i in 0..1) {
|
||||
var x = Integer(0)
|
||||
val istr = i.toString()
|
||||
|
||||
lambdas.add {
|
||||
println(istr)
|
||||
println(x.toString())
|
||||
x = x + 1
|
||||
}
|
||||
}
|
||||
|
||||
val lambda1 = lambdas[0]
|
||||
val lambda2 = lambdas[1]
|
||||
|
||||
lambda1()
|
||||
lambda2()
|
||||
lambda1()
|
||||
lambda2()
|
||||
}
|
||||
|
||||
class Integer(val value: Int) {
|
||||
override fun toString() = value.toString()
|
||||
operator fun plus(other: Int) = Integer(value + other)
|
||||
}
|
||||
Reference in New Issue
Block a user