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:
+12
@@ -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.
|
||||
*/
|
||||
|
||||
package zzz
|
||||
|
||||
open class B {
|
||||
val z by lazy { "qzz" }
|
||||
val x = 117
|
||||
val zzz = "zzz"
|
||||
}
|
||||
+18
@@ -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.
|
||||
*/
|
||||
|
||||
import zzz.*
|
||||
|
||||
class C : B() {
|
||||
val a = "qxx"
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val c = C()
|
||||
println(c.a)
|
||||
println(c.x)
|
||||
println(c.zzz)
|
||||
println(c.z)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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 a
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
open class A {
|
||||
open val x = 42
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
val f = 117
|
||||
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
|
||||
println(p.name)
|
||||
return f
|
||||
}
|
||||
}
|
||||
|
||||
open class B: A() {
|
||||
override val x: Int by Delegate()
|
||||
|
||||
fun bar() {
|
||||
println(super<A>.x)
|
||||
}
|
||||
}
|
||||
+22
@@ -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.
|
||||
*/
|
||||
|
||||
import a.*
|
||||
|
||||
open class C: B() {
|
||||
override val x: Int = 156
|
||||
|
||||
fun foo() {
|
||||
println(x)
|
||||
|
||||
println(super<B>.x)
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val c = C()
|
||||
c.foo()
|
||||
}
|
||||
@@ -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.delegatedProperty.lazy
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
val lazyValue: String by lazy {
|
||||
println("computed!")
|
||||
"Hello"
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
println(lazyValue)
|
||||
println(lazyValue)
|
||||
}
|
||||
@@ -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.delegatedProperty.local
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun foo(): Int {
|
||||
class Delegate {
|
||||
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
|
||||
println(p.name)
|
||||
return 42
|
||||
}
|
||||
}
|
||||
|
||||
val x: Int by Delegate()
|
||||
|
||||
return x
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
println(foo())
|
||||
}
|
||||
@@ -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.delegatedProperty.map
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
class User(val map: Map<String, Any?>) {
|
||||
val name: String by map
|
||||
val age: Int by map
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
val user = User(mapOf(
|
||||
"name" to "John Doe",
|
||||
"age" to 25
|
||||
))
|
||||
println(user.name) // Prints "John Doe"
|
||||
println(user.age) // Prints 25
|
||||
}
|
||||
@@ -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.delegatedProperty.observable
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
class User {
|
||||
var name: String by Delegates.observable("<no name>") {
|
||||
prop, old, new ->
|
||||
println("$old -> $new")
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
val user = User()
|
||||
user.name = "first"
|
||||
user.name = "second"
|
||||
}
|
||||
@@ -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.delegatedProperty.packageLevel
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
|
||||
println(p.name)
|
||||
return 42
|
||||
}
|
||||
}
|
||||
|
||||
val x: Int by Delegate()
|
||||
|
||||
@Test fun runTest() {
|
||||
println(x)
|
||||
}
|
||||
@@ -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.delegatedProperty.simpleVal
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
|
||||
println(p.name)
|
||||
return 42
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
val x: Int by Delegate()
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
println(C().x)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.delegatedProperty.simpleVar
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
var f: Int = 42
|
||||
|
||||
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
|
||||
println("get ${p.name}")
|
||||
return f
|
||||
}
|
||||
|
||||
operator fun setValue(receiver: Any?, p: KProperty<*>, value: Int) {
|
||||
println("set ${p.name}")
|
||||
f = value
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
var x: Int by Delegate()
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
val c = C()
|
||||
println(c.x)
|
||||
c.x = 117
|
||||
println(c.x)
|
||||
}
|
||||
Reference in New Issue
Block a user