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,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.
*/
sealed class Tag {
abstract fun value(): Any
}
sealed class TagBoolean : Tag() {
abstract override fun value(): Boolean
object True : TagBoolean() {
override fun value() = true
}
object False : TagBoolean() {
override fun value() = false
}
}
@@ -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>) {
val test: TagBoolean = TagBoolean.True
println(test.value())
}
@@ -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.
*/
package a
interface A<T> {
fun foo(): T
}
open class C: A<Int> {
override fun foo(): Int = 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.
*/
import a.*
class B: C()
fun main(args: Array<String>) {
val b = B()
println(b.foo())
val c: C = b
println(c.foo())
val a: A<Int> = b
println(a.foo())
}
@@ -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.bridges.nativePointed
import kotlinx.cinterop.*
import kotlin.test.*
abstract class C {
abstract fun foo(x: Int): CPointer<*>?
}
class CImpl : C() {
override fun foo(x: Int) = null
}
@Test fun runTest() {
val c: C = CImpl()
assertNull(c.foo(42))
}
@@ -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 codegen.bridges.signature
import kotlin.test.*
class A { }
class B { }
class C { }
interface Parser<in IN: Any, out OUT: Any> {
fun parse(source: IN): OUT
}
interface MultiParser<in IN: Any, out OUT: Any> {
fun parse(source: IN): Collection<OUT>
}
interface ExtendsInterface<T: Any>: Parser<A, T>, MultiParser<B, T> {
override fun parse(source: B): Collection<T> = ArrayList<T>()
}
abstract class AbstractClass(): ExtendsInterface<C> {
public override fun parse(source: A): C = C()
}
@Test fun runTest() {
val array = object : AbstractClass() { }.parse(B())
}
@@ -0,0 +1,46 @@
/*
* 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.bridges.special
import kotlin.test.*
private object NotEmptyMap : MutableMap<Any, Int> {
override fun containsKey(key: Any): Boolean = true
override fun containsValue(value: Int): Boolean = true
// non-special bridges get(Object)Integer -> get(Object)I
override fun get(key: Any): Int = 1
override fun remove(key: Any): Int = 1
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun put(key: Any, value: Int): Int? = throw UnsupportedOperationException()
override fun putAll(from: Map<out Any, Int>): Unit = throw UnsupportedOperationException()
override fun clear(): Unit = throw UnsupportedOperationException()
override val entries: MutableSet<MutableMap.MutableEntry<Any, Int>> get() = null!!
override val keys: MutableSet<Any> get() = null!!
override val values: MutableCollection<Int> get() = null!!
}
fun box(): String {
val n = NotEmptyMap as MutableMap<Any?, Any?>
if (n.get(null) != null) return "fail 1"
if (n.containsKey(null)) return "fail 2"
if (n.containsValue(null)) return "fail 3"
if (n.remove(null) != null) return "fail 4"
if (n.get(1) == null) return "fail 5"
if (!n.containsKey("")) return "fail 6"
if (!n.containsValue(3)) return "fail 7"
if (n.remove("") == null) return "fail 8"
return "Ok"
}
@Test fun runTest() {
println(box())
}
@@ -0,0 +1,24 @@
/*
* 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.bridges.test0
import kotlin.test.*
// vtable call
open class A {
open fun foo(): Any = "A"
}
open class C : A() {
override fun foo(): Int = 42
}
@Test fun runTest() {
val c = C()
val a: A = c
println(c.foo().toString())
println(a.foo().toString())
}
@@ -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.bridges.test1
import kotlin.test.*
// interface call, bridge overridden
interface Z1 {
fun foo(x: Int) : Any
}
open class A : Z1 {
override fun foo(x: Int) : Int = 5
}
open class B : A() {
override fun foo(x: Int) : Int = 42
}
@Test fun runTest() {
val z1: A = B()
println((z1.foo(1) + 1000).toString())
}
@@ -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.bridges.test10
import kotlin.test.*
open class A<T> {
open fun foo(x: T) {
println(x.toString())
}
}
interface I {
fun foo(x: Int)
}
class B : A<Int>(), I {
var z: Int = 5
override fun foo(x: Int) {
z = x
}
}
fun zzz(a: A<Int>) {
a.foo(42)
}
@Test fun runTest() {
val b = B()
zzz(b)
val a = A<Int>()
zzz(a)
println(b.z)
}
@@ -0,0 +1,29 @@
/*
* 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.bridges.test11
import kotlin.test.*
interface I {
fun foo(x: Int)
}
abstract class A<T> {
abstract fun foo(x: T)
}
class B : A<Int>(), I {
override fun foo(x: Int) = println(x)
}
@Test fun runTest() {
val b = B()
val a: A<Int> = b
val c: I = b
b.foo(42)
a.foo(42)
c.foo(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.bridges.test12
import kotlin.test.*
abstract class A<in T> {
abstract fun foo(x: T)
}
class B : A<Int>() {
override fun foo(x: Int) {
println("B: $x")
}
}
class C : A<Any>() {
override fun foo(x: Any) {
println("C: $x")
}
}
fun foo(arg: A<Int>) {
arg.foo(42)
}
@Test fun runTest() {
foo(B())
foo(C())
}
@@ -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.bridges.test13
import kotlin.test.*
open class A<T> {
open fun T.foo() {
println(this.toString())
}
fun bar(x: T) {
x.foo()
}
}
open class B: A<Int>() {
override fun Int.foo() {
println(this)
}
}
@Test fun runTest() {
val b = B()
val a = A<Int>()
b.bar(42)
a.bar(42)
}
@@ -0,0 +1,53 @@
/*
* 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.bridges.test14
import kotlin.test.*
open class A<T, U> {
open fun foo(x: T, y: U) {
println(x.toString())
println(y.toString())
}
}
interface I1<T> {
fun foo(x: Int, y: T)
}
interface I2<T> {
fun foo(x: T, y: Int)
}
class B : A<Int, Int>(), I1<Int>, I2<Int> {
var z: Int = 5
var q: Int = 7
override fun foo(x: Int, y: Int) {
z = x
q = y
}
}
fun zzz(a: A<Int, Int>) {
a.foo(42, 56)
}
@Test fun runTest() {
val b = B()
zzz(b)
val a = A<Int, Int>()
zzz(a)
println(b.z)
println(b.q)
val i1: I1<Int> = b
i1.foo(56, 42)
println(b.z)
println(b.q)
val i2: I2<Int> = b
i2.foo(156, 142)
println(b.z)
println(b.q)
}
@@ -0,0 +1,44 @@
/*
* 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.bridges.test15
import kotlin.test.*
// non-generic interface, generic impl, vtable call + interface call
open class A<T> {
open var size: T = 56 as T
}
interface C {
var size: Int
}
open class B : C, A<Int>()
open class D: B() {
override var size: Int = 117
}
fun <T> foo(a: A<T>) {
a.size = 42 as T
}
fun box(): String {
val b = B()
foo(b)
if (b.size != 42) return "fail 1"
val d = D()
if (d.size != 117) return "fail 2"
foo(d)
if (d.size != 42) return "fail 3"
return "OK"
}
@Test fun runTest() {
println(box())
}
@@ -0,0 +1,29 @@
/*
* 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.bridges.test16
import kotlin.test.*
interface A {
fun foo(): String
}
abstract class C: A
open class B: C() {
override fun foo(): String {
return "OK"
}
}
fun bar(c: C) = c.foo()
@Test fun runTest() {
val b = B()
val c: C = b
println(bar(b))
println(bar(c))
}
@@ -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 codegen.bridges.test17
import kotlin.test.*
// abstract bridge
interface A<T> {
fun foo(): T
}
abstract class B<T>: A<T>
abstract class C: B<Int>()
class D: C() {
override fun foo(): Int {
return 42
}
}
@Test fun runTest() {
val d = D()
val c: C = d
val b: B<Int> = d
val a: A<Int> = d
println(d.foo())
println(c.foo())
println(b.foo())
println(a.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.bridges.test18
import kotlin.test.*
// overriden function returns Unit
open class A {
open fun foo(): Any = 42
}
open class B: A() {
override fun foo(): Unit { }
}
@Test fun runTest() {
val a: A = B()
println(a.foo())
}
@@ -0,0 +1,26 @@
/*
* 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.bridges.test2
import kotlin.test.*
// vtable call, bridge inherited
open class A {
open fun foo(): Any = "A"
}
open class C : A() {
override fun foo(): Int = 42
}
open class D: C()
@Test fun runTest() {
val c = D()
val a: A = c
println(c.foo().toString())
println(a.foo().toString())
}
@@ -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.
*/
package codegen.bridges.test3
import kotlin.test.*
// non-generic interface, generic impl, non-virtual call + interface call
open class A<T> {
var size: T = 56 as T
}
interface C {
var size: Int
}
class B : C, A<Int>()
fun box(): String {
val b = B()
if (b.size != 56) return "fail 1"
b.size = 55
if (b.size != 55) return "fail 2"
val c: C = b
if (c.size != 55) return "fail 3"
c.size = 57
if (c.size != 57) return "fail 4"
return "OK"
}
@Test fun runTest() {
println(box())
}
@@ -0,0 +1,30 @@
/*
* 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.bridges.test4
import kotlin.test.*
// vtable call + interface call
interface Z {
fun foo(): Any
}
interface Y {
fun foo(): Int
}
open class A {
fun foo(): Int = 42
}
open class B: A(), Z, Y
@Test fun runTest() {
val z: Z = B()
val y: Y = z as Y
println(z.foo().toString())
println(y.foo().toString())
}
@@ -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.
*/
package codegen.bridges.test5
import kotlin.test.*
// non-generic interface, generic impl, vtable call + interface call
open class A<T> {
open var size: T = 56 as T
}
interface C {
var size: Int
}
open class B : C, A<Int>()
fun box(): String {
val b = B()
if (b.size != 56) return "fail 1"
b.size = 55
if (b.size != 55) return "fail 2"
val c: C = b
if (c.size != 55) return "fail 3"
c.size = 57
if (c.size != 57) return "fail 4"
return "OK"
}
@Test fun runTest() {
println(box())
}
@@ -0,0 +1,40 @@
/*
* 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.bridges.test6
import kotlin.test.*
// vtable call + interface call
interface Z {
fun foo(): Any
}
interface Y {
fun foo(): Int
}
open class A {
open fun foo(): Any = "A"
}
open class C : A() {
override fun foo(): Int = 42
}
open class D: C(), Y, Z
@Test fun runTest() {
val d = D()
val y: Y = d
val z: Z = d
val c: C = d
val a: A = d
println(d.foo().toString())
println(y.foo().toString())
println(z.foo().toString())
println(c.foo().toString())
println(a.foo().toString())
}
@@ -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.
*/
package codegen.bridges.test7
import kotlin.test.*
// generic interface, non-generic impl, vtable call + interface call
open class A {
open var size: Int = 56
}
interface C<T> {
var size: T
}
open class B : C<Int>, A()
fun box(): String {
val b = B()
if (b.size != 56) return "fail 1"
b.size = 55
if (b.size != 55) return "fail 2"
val c: C<Int> = b
if (c.size != 55) return "fail 3"
c.size = 57
if (c.size != 57) return "fail 4"
return "OK"
}
@Test fun runTest() {
println(box())
}
@@ -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.
*/
package codegen.bridges.test8
import kotlin.test.*
// generic interface, non-generic impl, non-virtual call + interface call
open class A {
var size: Int = 56
}
interface C<T> {
var size: T
}
class B : C<Int>, A()
fun box(): String {
val b = B()
if (b.size != 56) return "fail 1"
b.size = 55
if (b.size != 55) return "fail 2"
val c: C<Int> = b
if (c.size != 55) return "fail 3"
c.size = 57
if (c.size != 57) return "fail 4"
return "OK"
}
@Test fun runTest() {
println(box())
}
@@ -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.bridges.test9
import kotlin.test.*
// abstract class vtable call
abstract class A {
abstract fun foo(): String
}
abstract class B : A()
class Z : B() {
override fun foo() = "Z"
}
fun box(): String {
val z = Z()
val b: B = z
val a: A = z
return when {
z.foo() != "Z" -> "Fail #1"
b.foo() != "Z" -> "Fail #2"
a.foo() != "Z" -> "Fail #3"
else -> "OK"
}
}
@Test fun runTest() {
println(box())
}