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,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.kclass.kClassEnumArgument
import kotlin.test.*
import kotlin.reflect.KClass
enum class E(val arg: KClass<*>?) {
A(null as KClass<*>?),
B(String::class);
}
@Test fun runTest() {
println(E.B.arg?.simpleName)
}
@@ -0,0 +1,88 @@
/*
* 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.kclass.kclass0
import kotlin.test.*
import kotlin.reflect.KClass
@Test fun runTest() {
main(emptyArray<String>())
}
fun main(args: Array<String>) {
checkClass(Any::class, "kotlin.Any", "Any", Any(), null)
checkClass(Int::class, "kotlin.Int", "Int", 42, "17")
checkClass(String::class, "kotlin.String", "String", "17", 42)
checkClass(RootClass::class, "codegen.kclass.kclass0.RootClass", "RootClass", RootClass(), Any())
checkClass(RootClass.Nested::class, "codegen.kclass.kclass0.RootClass.Nested", "Nested", RootClass.Nested(), Any())
class Local {
val captured = args
inner class Inner
}
checkClass(Local::class, null, "Local", Local(), Any())
checkClass(Local.Inner::class, null, "Inner", Local().Inner(), Any())
val obj = object : Any() {
val captured = args
inner class Inner
val innerKClass = Inner::class
}
checkClass(obj::class, null, null, obj, Any())
checkClass(obj.innerKClass, null, "Inner", obj.Inner(), Any())
// Interfaces:
checkClass(Comparable::class, "kotlin.Comparable", "Comparable", 42, Any())
checkClass(Interface::class, "codegen.kclass.kclass0.Interface", "Interface", object : Interface {}, Any())
checkInstanceClass(Any(), Any::class)
checkInstanceClass(42, Int::class)
assert(42::class == Int::class)
checkReifiedClass<Int>(Int::class)
checkReifiedClass<Int?>(Int::class)
checkReifiedClass2<Int>(Int::class)
checkReifiedClass2<Int?>(Int::class)
checkReifiedClass<Any>(Any::class)
checkReifiedClass2<Any>(Any::class)
checkReifiedClass2<Any?>(Any::class)
checkReifiedClass<Local>(Local::class)
checkReifiedClass2<Local>(Local::class)
checkReifiedClass<RootClass>(RootClass::class)
checkReifiedClass2<RootClass>(RootClass::class)
}
class RootClass {
class Nested
}
interface Interface
fun checkClass(
clazz: KClass<*>,
expectedQualifiedName: String?, expectedSimpleName: String?,
expectedInstance: Any, expectedNotInstance: Any?
) {
assert(clazz.qualifiedName == expectedQualifiedName)
assert(clazz.simpleName == expectedSimpleName)
assert(clazz.isInstance(expectedInstance))
if (expectedNotInstance != null) assert(!clazz.isInstance(expectedNotInstance))
}
fun checkInstanceClass(instance: Any, clazz: KClass<*>) {
assert(instance::class == clazz)
}
inline fun <reified T> checkReifiedClass(expectedClass: KClass<*>) {
assert(T::class == expectedClass)
}
inline fun <reified T> checkReifiedClass2(expectedClass: KClass<*>) {
checkReifiedClass<T>(expectedClass)
checkReifiedClass<T?>(expectedClass)
}
@@ -0,0 +1,59 @@
/*
* 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.kclass.kclass1
import kotlin.test.*
// FILE: main.kt
@Test fun runTest() {
App(testQualified = true)
}
// FILE: app.kt
// Taken from:
// https://github.com/SalomonBrys/kmffkn/blob/master/shared/main/kotlin/com/github/salomonbrys/kmffkn/app.kt
@DslMarker
annotation class MyDsl
@MyDsl
class DslMain {
fun <T: Any> kClass(block: KClassDsl.() -> T): T = KClassDsl().block()
}
@MyDsl
class KClassDsl {
inline fun <reified T: Any> of() = T::class
}
fun <T: Any> dsl(block: DslMain.() -> T): T = DslMain().block()
class TestClass
class App(testQualified: Boolean) {
var type = dsl {
kClass {
//kClass { } // This should error if uncommented because of `@DslMarker`.
of<TestClass>()
}
}
init {
assert(type.simpleName == "TestClass")
if (testQualified)
assert(type.qualifiedName == "codegen.kclass.kclass1.TestClass") // This is not really necessary, but always better :).
assert(String::class == String::class)
assert(String::class != Int::class)
assert(TestClass()::class == TestClass()::class)
assert(TestClass()::class == TestClass::class)
println("OK :D")
}
}