[KLIB tool] Migrate 'dump-metadata' tests to K/N test infra
This commit is contained in:
committed by
Space Team
parent
57e004e2b0
commit
aa9b901926
@@ -2,33 +2,12 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
import org.jetbrains.kotlin.UtilsKt
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
apply from: "$rootDir/kotlin-native/gradle/kotlinGradlePlugin.gradle"
|
apply from: "$rootDir/kotlin-native/gradle/kotlinGradlePlugin.gradle"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
apply plugin: 'konan'
|
|
||||||
|
|
||||||
ext.useCustomDist = UtilsKt.getUseCustomDist(project)
|
|
||||||
|
|
||||||
konanArtifacts {
|
|
||||||
def testFiles = fileTree('src/test/testData') {
|
|
||||||
include "*.kt"
|
|
||||||
}
|
|
||||||
testFiles.files.each { file ->
|
|
||||||
def name = file.name
|
|
||||||
library(name.take(name.lastIndexOf('.'))) {
|
|
||||||
srcFiles file.absolutePath
|
|
||||||
|
|
||||||
// Build the compiler before building the test unless a custom path to the distribution is specified.
|
|
||||||
if (!useCustomDist) {
|
|
||||||
dependsOn ':dist'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs += ['-Xskip-prerelease-check']
|
kotlinOptions.freeCompilerArgs += ['-Xskip-prerelease-check']
|
||||||
@@ -51,13 +30,4 @@ dependencies {
|
|||||||
test {
|
test {
|
||||||
dependsOn 'cleanTest'
|
dependsOn 'cleanTest'
|
||||||
// Specify a path to the distribution that is used in the tests.
|
// Specify a path to the distribution that is used in the tests.
|
||||||
systemProperty('konan.home', UtilsKt.getKotlinNativeDist(project))
|
|
||||||
dependsOn konanArtifacts.collect { it.getByTarget('host') }
|
|
||||||
if (useCustomDist) {
|
|
||||||
// Use the klib utility from the distribution
|
|
||||||
def distClasspath = fileTree("${UtilsKt.getKotlinNativeDist(project)}/konan/lib") {
|
|
||||||
include "**/*.jar"
|
|
||||||
}
|
|
||||||
classpath = distClasspath + sourceSets.test.runtimeClasspath - sourceSets.main.runtimeClasspath
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-348
@@ -1,348 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 org.jetbrains.kotlin.cli.klib.test
|
|
||||||
|
|
||||||
import com.intellij.openapi.util.text.StringUtil
|
|
||||||
import kotlin.test.*
|
|
||||||
import org.jetbrains.kotlin.cli.klib.*
|
|
||||||
import org.jetbrains.kotlin.konan.target.Distribution
|
|
||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
|
||||||
import java.nio.file.Paths
|
|
||||||
|
|
||||||
class DumpMetadataTest {
|
|
||||||
|
|
||||||
private fun testLibrary(name: String) = LIBRARY_DIRECTORY.resolve("$name.klib").toFile().absolutePath
|
|
||||||
|
|
||||||
private fun dumpMetadata(library: String, printOutput: Boolean = false, expected: () -> String) {
|
|
||||||
val output = StringBuilder()
|
|
||||||
val lib = Library(library, null)
|
|
||||||
lib.dumpMetadata(output, false, null)
|
|
||||||
if (printOutput) {
|
|
||||||
println(output.trim().toString())
|
|
||||||
}
|
|
||||||
assertEquals(
|
|
||||||
StringUtil.convertLineSeparators(expected()),
|
|
||||||
StringUtil.convertLineSeparators(output.trim().toString()),
|
|
||||||
"klib \"dump-metadata\" test failed for library: $library"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `Stdlib content should be printed without exceptions`() {
|
|
||||||
val output = StringBuilder()
|
|
||||||
val distributionPath = System.getProperty("konan.home")
|
|
||||||
Library(Distribution(distributionPath).stdlib, null).dumpMetadata(output, false, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun topLevelFunctions() = dumpMetadata(testLibrary("TopLevelFunctions")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
annotation class A constructor() : Annotation
|
|
||||||
annotation class B constructor() : Annotation
|
|
||||||
class Foo constructor()
|
|
||||||
@A @B fun a()
|
|
||||||
fun Foo.e()
|
|
||||||
fun f1(x: Foo)
|
|
||||||
fun f2(x: Foo, y: Foo): Int
|
|
||||||
inline fun i1(block: () -> Foo)
|
|
||||||
inline fun i2(noinline block: () -> Foo)
|
|
||||||
inline fun i3(crossinline block: () -> Foo)
|
|
||||||
fun i4(block: (Foo) -> Int)
|
|
||||||
fun i5(block: (Foo, Foo) -> Int)
|
|
||||||
fun i6(block: Foo.() -> Int)
|
|
||||||
fun i7(block: Foo.(Foo) -> Int)
|
|
||||||
fun <T> t1(x: Foo)
|
|
||||||
fun <T> t2(x: T)
|
|
||||||
fun <T, F> t3(x: T, y: F)
|
|
||||||
inline fun <reified T> t4(x: T)
|
|
||||||
fun <T : Number> t5(x: T)
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun constructors() = dumpMetadata(testLibrary("Constructors")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
annotation class A constructor() : Annotation
|
|
||||||
class Bar @A constructor(x: Int)
|
|
||||||
class Baz private constructor(x: Int)
|
|
||||||
|
|
||||||
class Foo constructor(x: Int) {
|
|
||||||
constructor()
|
|
||||||
constructor(x: Double)
|
|
||||||
constructor(x: Double, y: Int)
|
|
||||||
protected constructor(x: String)
|
|
||||||
@A constructor(x: Foo)
|
|
||||||
}
|
|
||||||
|
|
||||||
class Qux protected constructor(x: Int)
|
|
||||||
|
|
||||||
class Typed<T> constructor(x: Int) {
|
|
||||||
constructor()
|
|
||||||
constructor(x: Double)
|
|
||||||
constructor(x: Double, y: Int)
|
|
||||||
protected constructor(x: String)
|
|
||||||
@A constructor(x: Foo)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun objects() = dumpMetadata(testLibrary("Objects")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
|
|
||||||
object A {
|
|
||||||
fun a()
|
|
||||||
}
|
|
||||||
|
|
||||||
class B constructor() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun b()
|
|
||||||
}
|
|
||||||
|
|
||||||
object C {
|
|
||||||
fun c()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class D constructor() {
|
|
||||||
|
|
||||||
companion object E {
|
|
||||||
fun e()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun classes() = dumpMetadata(testLibrary("Classes")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
|
|
||||||
class A constructor() {
|
|
||||||
val aVal: Int = 0
|
|
||||||
var aVar: String
|
|
||||||
fun aFun()
|
|
||||||
|
|
||||||
inner class B constructor() {
|
|
||||||
val bVal: Int = 0
|
|
||||||
var bVar: String
|
|
||||||
fun bFun()
|
|
||||||
|
|
||||||
inner class C constructor() {
|
|
||||||
val cVal: Int = 0
|
|
||||||
var cVar: String
|
|
||||||
fun cFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class E constructor() {
|
|
||||||
val eVal: Int = 0
|
|
||||||
var eVar: String
|
|
||||||
fun eFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
data class F constructor(fVal: Int, fVar: String) {
|
|
||||||
val fVal: Int
|
|
||||||
var fVar: String
|
|
||||||
operator fun component1(): Int
|
|
||||||
operator fun component2(): String
|
|
||||||
fun copy(fVal: Int = ..., fVar: String = ...): F
|
|
||||||
override fun equals(other: Any?): Boolean
|
|
||||||
fun fFun()
|
|
||||||
override fun hashCode(): Int
|
|
||||||
override fun toString(): String
|
|
||||||
}
|
|
||||||
|
|
||||||
class FinalImpl constructor() : OpenImpl {
|
|
||||||
override val iVal: Int = 0
|
|
||||||
override var iVar: String
|
|
||||||
override fun iFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Interface {
|
|
||||||
val iVal: Int
|
|
||||||
var iVar: String
|
|
||||||
fun iFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
open class OpenImpl constructor() : Interface {
|
|
||||||
override val iVal: Int = 0
|
|
||||||
override var iVar: String
|
|
||||||
override fun iFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun methodModality() = dumpMetadata(testLibrary("MethodModality")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
|
|
||||||
abstract class AbstractClass constructor() : Interface {
|
|
||||||
abstract fun abstractFun()
|
|
||||||
override fun interfaceFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
class FinalClass constructor() : OpenClass {
|
|
||||||
override fun openFun1()
|
|
||||||
final override fun openFun2()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Interface {
|
|
||||||
fun interfaceFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
open class OpenClass constructor() : AbstractClass {
|
|
||||||
override fun abstractFun()
|
|
||||||
fun finalFun()
|
|
||||||
open fun openFun1()
|
|
||||||
open fun openFun2()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun functionModifiers() = dumpMetadata(testLibrary("FunctionModifiers")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
|
|
||||||
class Foo constructor() {
|
|
||||||
fun f1()
|
|
||||||
infix fun f2(x: Int)
|
|
||||||
suspend fun f3()
|
|
||||||
tailrec fun f4()
|
|
||||||
fun f5(vararg x: Int)
|
|
||||||
operator fun plus(x: Int)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
// TODO: Support enum entry methods in serialization/deserialization.
|
|
||||||
fun enum() = dumpMetadata(testLibrary("Enum")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
|
|
||||||
enum class E private constructor(x: Int = ...) : Enum<E> {
|
|
||||||
enum entry A
|
|
||||||
enum entry B
|
|
||||||
enum entry C
|
|
||||||
val enumVal: Int = 0
|
|
||||||
var enumVar: String
|
|
||||||
val x: Int
|
|
||||||
open fun enumFun(): Int
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
// TODO: Support getter/setter annotations in serialization/deserialization.
|
|
||||||
fun accessors() = dumpMetadata(testLibrary("Accessors")) {
|
|
||||||
"""
|
|
||||||
package custom.pkg {
|
|
||||||
annotation class A constructor() : Annotation
|
|
||||||
|
|
||||||
class Foo constructor() {
|
|
||||||
@A val annotated: Int = 0
|
|
||||||
var annotatedAccessors: Int
|
|
||||||
@A get
|
|
||||||
@A set
|
|
||||||
val annotatedGetter: Int = 0
|
|
||||||
@A get
|
|
||||||
var annotatedSetter: Int
|
|
||||||
@A set
|
|
||||||
var privateSetter: Int
|
|
||||||
private set
|
|
||||||
protected val protectedSimple: Int = 0
|
|
||||||
val simple: Int = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun topLevelPropertiesCustomPackage() = dumpMetadata(testLibrary("TopLevelPropertiesCustomPackage")) {
|
|
||||||
"""
|
|
||||||
package custom.pkg {
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
val v1: Int = 1
|
|
||||||
val v2: String = "hello"
|
|
||||||
val v3: (String) -> Int
|
|
||||||
val v4: MyTransformer /* = (String) -> Int */
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun topLevelPropertiesRootPackage() = dumpMetadata(testLibrary("TopLevelPropertiesRootPackage")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
val v1: Int = 1
|
|
||||||
val v2: String = "hello"
|
|
||||||
val v3: (String) -> Int
|
|
||||||
val v4: MyTransformer /* = (String) -> Int */
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun topLevelPropertiesWithClassesCustomPackage() = dumpMetadata(testLibrary("TopLevelPropertiesWithClassesCustomPackage")) {
|
|
||||||
"""
|
|
||||||
package custom.pkg {
|
|
||||||
object Bar
|
|
||||||
class Foo constructor()
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
val v1: Int = 1
|
|
||||||
val v2: String = "hello"
|
|
||||||
val v3: (String) -> Int
|
|
||||||
val v4: MyTransformer /* = (String) -> Int */
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun topLevelPropertiesWithClassesRootPackage() = dumpMetadata(testLibrary("TopLevelPropertiesWithClassesRootPackage")) {
|
|
||||||
"""
|
|
||||||
package <root> {
|
|
||||||
object Bar
|
|
||||||
class Foo constructor()
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
val v1: Int = 1
|
|
||||||
val v2: String = "hello"
|
|
||||||
val v3: (String) -> Int
|
|
||||||
val v4: MyTransformer /* = (String) -> Int */
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
val LIBRARY_DIRECTORY = Paths.get("build/konan/libs").resolve(HostManager.hostName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package custom.pkg
|
|
||||||
|
|
||||||
annotation class A
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
val simple = 0
|
|
||||||
|
|
||||||
private val privateSimple = 0
|
|
||||||
|
|
||||||
protected val protectedSimple = 0
|
|
||||||
|
|
||||||
var privateSetter = 0
|
|
||||||
private set
|
|
||||||
|
|
||||||
@A val annotated = 0
|
|
||||||
|
|
||||||
val annotatedGetter = 0
|
|
||||||
@A get
|
|
||||||
|
|
||||||
var annotatedSetter = 0
|
|
||||||
@A set
|
|
||||||
|
|
||||||
var annotatedAccessors = 0
|
|
||||||
@A set
|
|
||||||
@A get
|
|
||||||
}
|
|
||||||
-27
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum class E(val x: Int = 0) {
|
|
||||||
A,
|
|
||||||
B,
|
|
||||||
C(1) {
|
|
||||||
override fun enumFun() = 42
|
|
||||||
};
|
|
||||||
|
|
||||||
open fun enumFun(): Int = 0
|
|
||||||
val enumVal = 0
|
|
||||||
var enumVar = ""
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
fun f1() {}
|
|
||||||
infix fun f2(x: Int) {}
|
|
||||||
suspend fun f3() {}
|
|
||||||
operator fun plus(x: Int) {}
|
|
||||||
tailrec fun f4() {}
|
|
||||||
fun f5(vararg x: Int) {}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
interface Interface {
|
|
||||||
fun interfaceFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class AbstractClass: Interface {
|
|
||||||
override fun interfaceFun() {}
|
|
||||||
abstract fun abstractFun()
|
|
||||||
}
|
|
||||||
|
|
||||||
open class OpenClass: AbstractClass() {
|
|
||||||
override fun abstractFun() {}
|
|
||||||
open fun openFun1() {}
|
|
||||||
open fun openFun2() {}
|
|
||||||
fun finalFun() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FinalClass: OpenClass() {
|
|
||||||
override fun openFun1() {}
|
|
||||||
final override fun openFun2() {}
|
|
||||||
}
|
|
||||||
-35
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
object A {
|
|
||||||
fun a() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
companion object {
|
|
||||||
fun b() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
object C {
|
|
||||||
fun c() {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class D {
|
|
||||||
companion object E {
|
|
||||||
fun e() {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("UNUSED_PARAMETER")
|
|
||||||
|
|
||||||
package custom.pkg
|
|
||||||
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
|
|
||||||
// top-level properties
|
|
||||||
val v1 = 1
|
|
||||||
val v2 = "hello"
|
|
||||||
val v3: (String) -> Int = { it.length }
|
|
||||||
val v4: MyTransformer = v3
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("UNUSED_PARAMETER")
|
|
||||||
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
|
|
||||||
// top-level properties
|
|
||||||
val v1 = 1
|
|
||||||
val v2 = "hello"
|
|
||||||
val v3: (String) -> Int = { it.length }
|
|
||||||
val v4: MyTransformer = v3
|
|
||||||
|
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("UNUSED_PARAMETER")
|
|
||||||
|
|
||||||
package custom.pkg
|
|
||||||
|
|
||||||
class Foo
|
|
||||||
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
|
|
||||||
// top-level properties
|
|
||||||
val v1 = 1
|
|
||||||
val v2 = "hello"
|
|
||||||
val v3: (String) -> Int = { it.length }
|
|
||||||
val v4: MyTransformer = v3
|
|
||||||
|
|
||||||
object Bar
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("UNUSED_PARAMETER")
|
|
||||||
|
|
||||||
class Foo
|
|
||||||
|
|
||||||
typealias MyTransformer = (String) -> Int
|
|
||||||
|
|
||||||
// top-level properties
|
|
||||||
val v1 = 1
|
|
||||||
val v2 = "hello"
|
|
||||||
val v3: (String) -> Int = { it.length }
|
|
||||||
val v4: MyTransformer = v3
|
|
||||||
|
|
||||||
object Bar
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package custom.pkg
|
||||||
|
|
||||||
|
annotation class A
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
val simple = 0
|
||||||
|
|
||||||
|
private val privateSimple = 0
|
||||||
|
|
||||||
|
protected val protectedSimple = 0
|
||||||
|
|
||||||
|
var privateSetter = 0
|
||||||
|
private set
|
||||||
|
|
||||||
|
@A val annotated = 0
|
||||||
|
|
||||||
|
val annotatedGetter = 0
|
||||||
|
@A get
|
||||||
|
|
||||||
|
var annotatedSetter = 0
|
||||||
|
@A set
|
||||||
|
|
||||||
|
var annotatedAccessors = 0
|
||||||
|
@A set
|
||||||
|
@A get
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package custom.pkg {
|
||||||
|
annotation class A constructor() : Annotation
|
||||||
|
class Foo constructor() {
|
||||||
|
@A val annotated: Int = 0
|
||||||
|
var annotatedAccessors: Int
|
||||||
|
@A get
|
||||||
|
@A set
|
||||||
|
val annotatedGetter: Int = 0
|
||||||
|
@A get
|
||||||
|
var annotatedSetter: Int
|
||||||
|
@A set
|
||||||
|
var privateSetter: Int
|
||||||
|
private set
|
||||||
|
protected val protectedSimple: Int = 0
|
||||||
|
val simple: Int = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
-16
@@ -1,19 +1,3 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
fun aFun() {}
|
fun aFun() {}
|
||||||
val aVal = 0
|
val aVal = 0
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package <root> {
|
||||||
|
class A constructor() {
|
||||||
|
val aVal: Int = 0
|
||||||
|
var aVar: String
|
||||||
|
fun aFun()
|
||||||
|
inner class B constructor() {
|
||||||
|
val bVal: Int = 0
|
||||||
|
var bVar: String
|
||||||
|
fun bFun()
|
||||||
|
inner class C constructor() {
|
||||||
|
val cVal: Int = 0
|
||||||
|
var cVar: String
|
||||||
|
fun cFun()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class E constructor() {
|
||||||
|
val eVal: Int = 0
|
||||||
|
var eVar: String
|
||||||
|
fun eFun()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data class F constructor(fVal: Int, fVar: String) {
|
||||||
|
val fVal: Int
|
||||||
|
var fVar: String
|
||||||
|
operator fun component1(): Int
|
||||||
|
operator fun component2(): String
|
||||||
|
fun copy(fVal: Int = ..., fVar: String = ...): F
|
||||||
|
override fun equals(other: Any?): Boolean
|
||||||
|
fun fFun()
|
||||||
|
override fun hashCode(): Int
|
||||||
|
override fun toString(): String
|
||||||
|
}
|
||||||
|
class FinalImpl constructor() : OpenImpl {
|
||||||
|
override val iVal: Int = 0
|
||||||
|
override var iVar: String
|
||||||
|
override fun iFun()
|
||||||
|
}
|
||||||
|
interface Interface {
|
||||||
|
val iVal: Int
|
||||||
|
var iVar: String
|
||||||
|
fun iFun()
|
||||||
|
}
|
||||||
|
open class OpenImpl constructor() : Interface {
|
||||||
|
override val iVal: Int = 0
|
||||||
|
override var iVar: String
|
||||||
|
override fun iFun()
|
||||||
|
}
|
||||||
|
}
|
||||||
-16
@@ -1,19 +1,3 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("UNUSED_PARAMETER")
|
@file:Suppress("UNUSED_PARAMETER")
|
||||||
|
|
||||||
annotation class A
|
annotation class A
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package <root> {
|
||||||
|
annotation class A constructor() : Annotation
|
||||||
|
class Bar @A constructor(x: Int)
|
||||||
|
class Baz private constructor(x: Int)
|
||||||
|
class Foo constructor(x: Int) {
|
||||||
|
constructor()
|
||||||
|
constructor(x: Double)
|
||||||
|
constructor(x: Double, y: Int)
|
||||||
|
protected constructor(x: String)
|
||||||
|
@A constructor(x: Foo)
|
||||||
|
}
|
||||||
|
class Qux protected constructor(x: Int)
|
||||||
|
class Typed<T> constructor(x: Int) {
|
||||||
|
constructor()
|
||||||
|
constructor(x: Double)
|
||||||
|
constructor(x: Double, y: Int)
|
||||||
|
protected constructor(x: String)
|
||||||
|
@A constructor(x: Foo)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
enum class E(val x: Int = 0) {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
C(1) {
|
||||||
|
override fun enumFun() = 42
|
||||||
|
};
|
||||||
|
|
||||||
|
open fun enumFun(): Int = 0
|
||||||
|
val enumVal = 0
|
||||||
|
var enumVar = ""
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package <root> {
|
||||||
|
enum class E private constructor(x: Int = ...) : Enum<E> {
|
||||||
|
enum entry A
|
||||||
|
enum entry B
|
||||||
|
enum entry C
|
||||||
|
val enumVal: Int = 0
|
||||||
|
var enumVar: String
|
||||||
|
val x: Int
|
||||||
|
open fun enumFun(): Int
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class Foo {
|
||||||
|
fun f1() {}
|
||||||
|
infix fun f2(x: Int) {}
|
||||||
|
suspend fun f3() {}
|
||||||
|
operator fun plus(x: Int) {}
|
||||||
|
tailrec fun f4() {}
|
||||||
|
fun f5(vararg x: Int) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package <root> {
|
||||||
|
class Foo constructor() {
|
||||||
|
fun f1()
|
||||||
|
infix fun f2(x: Int)
|
||||||
|
suspend fun f3()
|
||||||
|
tailrec fun f4()
|
||||||
|
fun f5(vararg x: Int)
|
||||||
|
operator fun plus(x: Int)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
interface Interface {
|
||||||
|
fun interfaceFun()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class AbstractClass: Interface {
|
||||||
|
override fun interfaceFun() {}
|
||||||
|
abstract fun abstractFun()
|
||||||
|
}
|
||||||
|
|
||||||
|
open class OpenClass: AbstractClass() {
|
||||||
|
override fun abstractFun() {}
|
||||||
|
open fun openFun1() {}
|
||||||
|
open fun openFun2() {}
|
||||||
|
fun finalFun() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FinalClass: OpenClass() {
|
||||||
|
override fun openFun1() {}
|
||||||
|
final override fun openFun2() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package <root> {
|
||||||
|
abstract class AbstractClass constructor() : Interface {
|
||||||
|
abstract fun abstractFun()
|
||||||
|
override fun interfaceFun()
|
||||||
|
}
|
||||||
|
class FinalClass constructor() : OpenClass {
|
||||||
|
override fun openFun1()
|
||||||
|
final override fun openFun2()
|
||||||
|
}
|
||||||
|
interface Interface {
|
||||||
|
fun interfaceFun()
|
||||||
|
}
|
||||||
|
open class OpenClass constructor() : AbstractClass {
|
||||||
|
override fun abstractFun()
|
||||||
|
fun finalFun()
|
||||||
|
open fun openFun1()
|
||||||
|
open fun openFun2()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// B.Companion and B.C are serialized in a different order in K1 and K2
|
||||||
|
// MUTED_WHEN: K1
|
||||||
|
object A {
|
||||||
|
fun a() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B {
|
||||||
|
companion object {
|
||||||
|
fun b() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
object C {
|
||||||
|
fun c() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class D {
|
||||||
|
companion object E {
|
||||||
|
fun e() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package <root> {
|
||||||
|
object A {
|
||||||
|
fun a()
|
||||||
|
}
|
||||||
|
class B constructor() {
|
||||||
|
companion object {
|
||||||
|
fun b()
|
||||||
|
}
|
||||||
|
object C {
|
||||||
|
fun c()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class D constructor() {
|
||||||
|
companion object E {
|
||||||
|
fun e()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
-16
@@ -1,19 +1,3 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("UNUSED_PARAMETER")
|
@file:Suppress("UNUSED_PARAMETER")
|
||||||
|
|
||||||
annotation class A
|
annotation class A
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package <root> {
|
||||||
|
annotation class A constructor() : Annotation
|
||||||
|
annotation class B constructor() : Annotation
|
||||||
|
class Foo constructor()
|
||||||
|
@A @B fun a()
|
||||||
|
fun Foo.e()
|
||||||
|
fun f1(x: Foo)
|
||||||
|
fun f2(x: Foo, y: Foo): Int
|
||||||
|
inline fun i1(block: () -> Foo)
|
||||||
|
inline fun i2(noinline block: () -> Foo)
|
||||||
|
inline fun i3(crossinline block: () -> Foo)
|
||||||
|
fun i4(block: (Foo) -> Int)
|
||||||
|
fun i5(block: (Foo, Foo) -> Int)
|
||||||
|
fun i6(block: Foo.() -> Int)
|
||||||
|
fun i7(block: Foo.(Foo) -> Int)
|
||||||
|
fun <T> t1(x: Foo)
|
||||||
|
fun <T> t2(x: T)
|
||||||
|
fun <T, F> t3(x: T, y: F)
|
||||||
|
inline fun <reified T> t4(x: T)
|
||||||
|
fun <T : Number> t5(x: T)
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
@file:Suppress("UNUSED_PARAMETER")
|
||||||
|
|
||||||
|
package custom.pkg
|
||||||
|
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
|
||||||
|
// top-level properties
|
||||||
|
val v1 = 1
|
||||||
|
val v2 = "hello"
|
||||||
|
val v3: (String) -> Int = { it.length }
|
||||||
|
val v4: MyTransformer = v3
|
||||||
|
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package custom.pkg {
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
val v1: Int = 1
|
||||||
|
val v2: String = "hello"
|
||||||
|
val v3: (String) -> Int
|
||||||
|
val v4: MyTransformer /* = (String) -> Int */
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
@file:Suppress("UNUSED_PARAMETER")
|
||||||
|
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
|
||||||
|
// top-level properties
|
||||||
|
val v1 = 1
|
||||||
|
val v2 = "hello"
|
||||||
|
val v3: (String) -> Int = { it.length }
|
||||||
|
val v4: MyTransformer = v3
|
||||||
|
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package <root> {
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
val v1: Int = 1
|
||||||
|
val v2: String = "hello"
|
||||||
|
val v3: (String) -> Int
|
||||||
|
val v4: MyTransformer /* = (String) -> Int */
|
||||||
|
}
|
||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
@file:Suppress("UNUSED_PARAMETER")
|
||||||
|
|
||||||
|
package custom.pkg
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
|
||||||
|
// top-level properties
|
||||||
|
val v1 = 1
|
||||||
|
val v2 = "hello"
|
||||||
|
val v3: (String) -> Int = { it.length }
|
||||||
|
val v4: MyTransformer = v3
|
||||||
|
|
||||||
|
object Bar
|
||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package custom.pkg {
|
||||||
|
object Bar
|
||||||
|
class Foo constructor()
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
val v1: Int = 1
|
||||||
|
val v2: String = "hello"
|
||||||
|
val v3: (String) -> Int
|
||||||
|
val v4: MyTransformer /* = (String) -> Int */
|
||||||
|
}
|
||||||
Vendored
+13
@@ -0,0 +1,13 @@
|
|||||||
|
@file:Suppress("UNUSED_PARAMETER")
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
|
||||||
|
// top-level properties
|
||||||
|
val v1 = 1
|
||||||
|
val v2 = "hello"
|
||||||
|
val v3: (String) -> Int = { it.length }
|
||||||
|
val v4: MyTransformer = v3
|
||||||
|
|
||||||
|
object Bar
|
||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package <root> {
|
||||||
|
object Bar
|
||||||
|
class Foo constructor()
|
||||||
|
typealias MyTransformer = (String) -> Int
|
||||||
|
val v1: Int = 1
|
||||||
|
val v2: String = "hello"
|
||||||
|
val v3: (String) -> Int
|
||||||
|
val v4: MyTransformer /* = (String) -> Int */
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
annotation class AnnoBackingField constructor() : Annotation
|
annotation class AnnoBackingField constructor() : Annotation
|
||||||
annotation class AnnoClass constructor() : Annotation
|
annotation class AnnoClass constructor() : Annotation
|
||||||
@Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) annotation class AnnoClassTypeParameter constructor() : Annotation
|
@Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) annotation class AnnoClassTypeParameter constructor() : Annotation
|
||||||
@@ -28,3 +29,4 @@
|
|||||||
@AnnoPropertyExtensionReceiver val Foo.extProp: Int
|
@AnnoPropertyExtensionReceiver val Foo.extProp: Int
|
||||||
@AnnoFunction fun @receiver:AnnoFunctionExtensionReceiver Foo.extfun(@AnnoFunctionParam x: Int)
|
@AnnoFunction fun @receiver:AnnoFunctionExtensionReceiver Foo.extfun(@AnnoFunctionParam x: Int)
|
||||||
fun <@AnnoFunctionTypeParameter T> f(x: B<@AnnoClassUsageTypeParameter Int>)
|
fun <@AnnoFunctionTypeParameter T> f(x: B<@AnnoClassUsageTypeParameter Int>)
|
||||||
|
}
|
||||||
+2
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoBackingField constructor() : Annotation
|
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoBackingField constructor() : Annotation
|
||||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoClass constructor() : Annotation
|
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoClass constructor() : Annotation
|
||||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoConstructor constructor() : Annotation
|
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoConstructor constructor() : Annotation
|
||||||
@@ -20,3 +21,4 @@
|
|||||||
}
|
}
|
||||||
val Foo.extProp: Int
|
val Foo.extProp: Int
|
||||||
fun Foo.extfun(x: Int)
|
fun Foo.extfun(x: Int)
|
||||||
|
}
|
||||||
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
annotation class Anno constructor(value: String = ..., x: Int = ...) : Annotation {
|
annotation class Anno constructor(value: String = ..., x: Int = ...) : Annotation {
|
||||||
val value: String
|
val value: String
|
||||||
val x: Int
|
val x: Int
|
||||||
@@ -8,4 +9,5 @@
|
|||||||
enum entry Entry2
|
enum entry Entry2
|
||||||
@Anno(value = "3") @Bnno enum entry Entry3
|
@Anno(value = "3") @Bnno enum entry Entry3
|
||||||
@Anno(value = "4", x = 4) enum entry Entry4
|
@Anno(value = "4", x = 4) enum entry Entry4
|
||||||
}
|
}
|
||||||
|
}
|
||||||
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
annotation class AnnotationArray constructor(annotationArray: Array<JustAnnotation>) : Annotation {
|
annotation class AnnotationArray constructor(annotationArray: Array<JustAnnotation>) : Annotation {
|
||||||
val annotationArray: Array<JustAnnotation>
|
val annotationArray: Array<JustAnnotation>
|
||||||
}
|
}
|
||||||
@@ -6,4 +7,5 @@
|
|||||||
annotation class Empty constructor() : Annotation
|
annotation class Empty constructor() : Annotation
|
||||||
annotation class JustAnnotation constructor(annotation: Empty) : Annotation {
|
annotation class JustAnnotation constructor(annotation: Empty) : Annotation {
|
||||||
val annotation: Empty
|
val annotation: Empty
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
@JustEnum(weapon = Weapon.SCISSORS) @EnumArray(enumArray = {}) class C1 constructor()
|
@JustEnum(weapon = Weapon.SCISSORS) @EnumArray(enumArray = {}) class C1 constructor()
|
||||||
@EnumArray(enumArray = {Weapon.PAPER, Weapon.ROCK}) class C2 constructor()
|
@EnumArray(enumArray = {Weapon.PAPER, Weapon.ROCK}) class C2 constructor()
|
||||||
annotation class EnumArray constructor(enumArray: Array<Weapon>) : Annotation {
|
annotation class EnumArray constructor(enumArray: Array<Weapon>) : Annotation {
|
||||||
@@ -10,4 +11,5 @@
|
|||||||
enum entry ROCK
|
enum entry ROCK
|
||||||
enum entry PAPER
|
enum entry PAPER
|
||||||
enum entry SCISSORS
|
enum entry SCISSORS
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+2
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
@PrimitiveArrays(booleanArray = {true, false, true}, byteArray = {-7.toByte(), 7.toByte()}, charArray = {\u0025 ('%'), \u007A ('z')}, doubleArray = {-3.14.toDouble()}, floatArray = {2.72.toFloat(), 0.0.toFloat()}, intArray = {239017, -1}, longArray = {123456789123456789.toLong()}, shortArray = {239.toShort()}) class C1 constructor()
|
@PrimitiveArrays(booleanArray = {true, false, true}, byteArray = {-7.toByte(), 7.toByte()}, charArray = {\u0025 ('%'), \u007A ('z')}, doubleArray = {-3.14.toDouble()}, floatArray = {2.72.toFloat(), 0.0.toFloat()}, intArray = {239017, -1}, longArray = {123456789123456789.toLong()}, shortArray = {239.toShort()}) class C1 constructor()
|
||||||
@PrimitiveArrays(booleanArray = {}, byteArray = {}, charArray = {}, doubleArray = {}, floatArray = {}, intArray = {}, longArray = {}, shortArray = {}) class C2 constructor()
|
@PrimitiveArrays(booleanArray = {}, byteArray = {}, charArray = {}, doubleArray = {}, floatArray = {}, intArray = {}, longArray = {}, shortArray = {}) class C2 constructor()
|
||||||
annotation class PrimitiveArrays constructor(byteArray: ByteArray, charArray: CharArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray, booleanArray: BooleanArray) : Annotation {
|
annotation class PrimitiveArrays constructor(byteArray: ByteArray, charArray: CharArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray, booleanArray: BooleanArray) : Annotation {
|
||||||
@@ -10,3 +11,4 @@
|
|||||||
val longArray: LongArray
|
val longArray: LongArray
|
||||||
val shortArray: ShortArray
|
val shortArray: ShortArray
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+2
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
@Primitives(boolean = true, byte = 7.toByte(), char = \u0025 ('%'), double = -3.14.toDouble(), float = 2.72.toFloat(), int = 239017, long = 123456789123456789.toLong(), short = 239.toShort()) class C constructor()
|
@Primitives(boolean = true, byte = 7.toByte(), char = \u0025 ('%'), double = -3.14.toDouble(), float = 2.72.toFloat(), int = 239017, long = 123456789123456789.toLong(), short = 239.toShort()) class C constructor()
|
||||||
annotation class Primitives constructor(byte: Byte, char: Char, short: Short, int: Int, long: Long, float: Float, double: Double, boolean: Boolean) : Annotation {
|
annotation class Primitives constructor(byte: Byte, char: Char, short: Short, int: Int, long: Long, float: Float, double: Double, boolean: Boolean) : Annotation {
|
||||||
val boolean: Boolean
|
val boolean: Boolean
|
||||||
@@ -9,3 +10,4 @@
|
|||||||
val long: Long
|
val long: Long
|
||||||
val short: Short
|
val short: Short
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
@JustString(string = "kotlin") @StringArray(stringArray = {}) class C1 constructor()
|
@JustString(string = "kotlin") @StringArray(stringArray = {}) class C1 constructor()
|
||||||
@StringArray(stringArray = {"java", ""}) class C2 constructor()
|
@StringArray(stringArray = {"java", ""}) class C2 constructor()
|
||||||
annotation class JustString constructor(string: String) : Annotation {
|
annotation class JustString constructor(string: String) : Annotation {
|
||||||
@@ -5,4 +6,5 @@
|
|||||||
}
|
}
|
||||||
annotation class StringArray constructor(stringArray: Array<String>) : Annotation {
|
annotation class StringArray constructor(stringArray: Array<String>) : Annotation {
|
||||||
val stringArray: Array<String>
|
val stringArray: Array<String>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
enum class My private constructor() : Enum<My> {
|
enum class My private constructor() : Enum<My> {
|
||||||
enum entry ALPHA
|
enum entry ALPHA
|
||||||
enum entry BETA
|
enum entry BETA
|
||||||
@@ -6,4 +7,5 @@
|
|||||||
annotation class ann constructor(vararg m: My) : Annotation {
|
annotation class ann constructor(vararg m: My) : Annotation {
|
||||||
val m: Array<out My>
|
val m: Array<out My>
|
||||||
}
|
}
|
||||||
@ann(m = {My.ALPHA, My.BETA}) annotation class annotated constructor() : Annotation
|
@ann(m = {My.ALPHA, My.BETA}) annotation class annotated constructor() : Annotation
|
||||||
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
@anno(x = "top level class") class C1 @anno(x = "constructor") constructor() {
|
@anno(x = "top level class") class C1 @anno(x = "constructor") constructor() {
|
||||||
@anno(x = "member property") val p3: Nothing?
|
@anno(x = "member property") val p3: Nothing?
|
||||||
@anno(x = "member extension property") val Int.v4: Int
|
@anno(x = "member extension property") val Int.v4: Int
|
||||||
@@ -12,4 +13,5 @@
|
|||||||
@anno(x = "top level function") fun f1(@anno(x = "top level function parameter") p: Int)
|
@anno(x = "top level function") fun f1(@anno(x = "top level function parameter") p: Int)
|
||||||
@anno(x = "extension function") fun Long.f2(@anno(x = "extension function parameter") p: Int)
|
@anno(x = "extension function") fun Long.f2(@anno(x = "extension function parameter") p: Int)
|
||||||
@anno(x = "top level property") val p1: Nothing?
|
@anno(x = "top level property") val p1: Nothing?
|
||||||
@anno(x = "extension property") val Double.p2: Double
|
@anno(x = "extension property") val Double.p2: Double
|
||||||
|
}
|
||||||
Vendored
+3
-1
@@ -1,7 +1,9 @@
|
|||||||
|
package test {
|
||||||
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) annotation class A constructor() : Annotation
|
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) annotation class A constructor() : Annotation
|
||||||
enum class Enum private constructor() : Enum<Enum> {
|
enum class Enum private constructor() : Enum<Enum> {
|
||||||
@A enum entry ENTRY
|
@A enum entry ENTRY
|
||||||
}
|
}
|
||||||
@A class Klass @A constructor()
|
@A class Klass @A constructor()
|
||||||
@A fun <@A T> function(@A param: Unit)
|
@A fun <@A T> function(@A param: Unit)
|
||||||
@A val property: Unit
|
@A val property: Unit
|
||||||
|
}
|
||||||
Vendored
+2
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
class Class constructor() {
|
class Class constructor() {
|
||||||
val arrayConst: Any = {1.toByte(), 2.toByte()}
|
val arrayConst: Any = {1.toByte(), 2.toByte()}
|
||||||
val booleanConst: Boolean = true
|
val booleanConst: Boolean = true
|
||||||
@@ -27,3 +28,4 @@
|
|||||||
val longConst: Long = 40.toLong()
|
val longConst: Long = 40.toLong()
|
||||||
val shortConst: Short = 20.toShort()
|
val shortConst: Short = 20.toShort()
|
||||||
val stringConst: String = "abcd"
|
val stringConst: String = "abcd"
|
||||||
|
}
|
||||||
Vendored
+2
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
class ClassA constructor() {
|
class ClassA constructor() {
|
||||||
class classB constructor() {
|
class classB constructor() {
|
||||||
fun memberFromB(): Int
|
fun memberFromB(): Int
|
||||||
@@ -25,3 +26,4 @@
|
|||||||
val memberFromObjA: Int = 300
|
val memberFromObjA: Int = 300
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Vendored
+3
-1
@@ -1,7 +1,9 @@
|
|||||||
|
package test {
|
||||||
annotation class Anno constructor(value: String) : Annotation {
|
annotation class Anno constructor(value: String) : Annotation {
|
||||||
val value: String
|
val value: String
|
||||||
}
|
}
|
||||||
@Anno(value = "property") val v1: String = ""
|
@Anno(value = "property") val v1: String = ""
|
||||||
var v2: String
|
var v2: String
|
||||||
@Anno(value = "getter") get
|
@Anno(value = "getter") get
|
||||||
@Anno(value = "setter") set
|
@Anno(value = "setter") set
|
||||||
|
}
|
||||||
+3
-1
@@ -1,6 +1,8 @@
|
|||||||
|
package test {
|
||||||
class Class constructor() {
|
class Class constructor() {
|
||||||
fun member(): Nothing?
|
fun member(): Nothing?
|
||||||
}
|
}
|
||||||
fun <T> T.extension(): T?
|
fun <T> T.extension(): T?
|
||||||
fun function(int: Int, string: String = ...): Class
|
fun function(int: Int, string: String = ...): Class
|
||||||
val property: Unit
|
val property: Unit
|
||||||
|
}
|
||||||
Vendored
+3
-1
@@ -1,7 +1,9 @@
|
|||||||
|
package test {
|
||||||
@Retention(value = AnnotationRetention.SOURCE) @Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) annotation class A constructor() : Annotation
|
@Retention(value = AnnotationRetention.SOURCE) @Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) annotation class A constructor() : Annotation
|
||||||
enum class Enum private constructor() : Enum<Enum> {
|
enum class Enum private constructor() : Enum<Enum> {
|
||||||
enum entry ENTRY
|
enum entry ENTRY
|
||||||
}
|
}
|
||||||
class Klass constructor()
|
class Klass constructor()
|
||||||
fun <T> function(param: Unit)
|
fun <T> function(param: Unit)
|
||||||
val property: Unit
|
val property: Unit
|
||||||
|
}
|
||||||
+2
-1
@@ -3,4 +3,5 @@ package <root> {
|
|||||||
object Obj {
|
object Obj {
|
||||||
const val O: String = "O"
|
const val O: String = "O"
|
||||||
val concat: String = "OK"
|
val concat: String = "OK"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Vendored
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
|
package test {
|
||||||
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) annotation class Ann constructor(value: String) : Annotation {
|
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) annotation class Ann constructor(value: String) : Annotation {
|
||||||
val value: String
|
val value: String
|
||||||
}
|
}
|
||||||
inline fun <reified @Ann(value = "abc") T> foo()
|
inline fun <reified @Ann(value = "abc") T> foo()
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
package test {
|
||||||
data class DataClass constructor(intProp: Int, stringProp: String) {
|
data class DataClass constructor(intProp: Int, stringProp: String) {
|
||||||
val intProp: Int
|
val intProp: Int
|
||||||
val nonConstructorProp: Int = 0
|
val nonConstructorProp: Int = 0
|
||||||
@@ -13,4 +14,5 @@
|
|||||||
override fun equals(other: Any?): Boolean
|
override fun equals(other: Any?): Boolean
|
||||||
override fun hashCode(): Int
|
override fun hashCode(): Int
|
||||||
override fun toString(): String
|
override fun toString(): String
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
|
package test {
|
||||||
class A constructor() {
|
class A constructor() {
|
||||||
@field:Ann var x: Int
|
@field:Ann var x: Int
|
||||||
@delegate:Ann var y: Int
|
@delegate:Ann var y: Int
|
||||||
}
|
}
|
||||||
annotation class Ann constructor() : Annotation
|
annotation class Ann constructor() : Annotation
|
||||||
@field:Ann var x: Int
|
@field:Ann var x: Int
|
||||||
@delegate:Ann var y: Int
|
@delegate:Ann var y: Int
|
||||||
|
}
|
||||||
+3
-1
@@ -1,7 +1,9 @@
|
|||||||
|
package test {
|
||||||
class A constructor() {
|
class A constructor() {
|
||||||
@Ann val @receiver:Ann Int.bar: Int
|
@Ann val @receiver:Ann Int.bar: Int
|
||||||
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int): Int
|
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int): Int
|
||||||
}
|
}
|
||||||
annotation class Ann constructor() : Annotation
|
annotation class Ann constructor() : Annotation
|
||||||
@Ann val @receiver:Ann Int.bar: Int
|
@Ann val @receiver:Ann Int.bar: Int
|
||||||
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int): Int
|
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int): Int
|
||||||
|
}
|
||||||
+3
-1
@@ -1,2 +1,4 @@
|
|||||||
|
package test {
|
||||||
class C constructor()
|
class C constructor()
|
||||||
fun C.builder(c: C.() -> Unit)
|
fun C.builder(c: C.() -> Unit)
|
||||||
|
}
|
||||||
+3
-1
@@ -1,2 +1,4 @@
|
|||||||
|
package test {
|
||||||
annotation class Annotation constructor() : Annotation
|
annotation class Annotation constructor() : Annotation
|
||||||
fun foo(@Annotation arg: Int)
|
fun foo(@Annotation arg: Int)
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
abstract class A constructor() {
|
package test {
|
||||||
|
abstract class A constructor() {
|
||||||
abstract val a: Int
|
abstract val a: Int
|
||||||
abstract var b: Int
|
abstract var b: Int
|
||||||
protected set
|
protected set
|
||||||
@@ -13,3 +14,4 @@ abstract class A constructor() {
|
|||||||
open var l: Int
|
open var l: Int
|
||||||
protected set
|
protected set
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
|
package test {
|
||||||
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoBinary constructor() : Annotation
|
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoBinary constructor() : Annotation
|
||||||
@Retention(value = AnnotationRetention.RUNTIME) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoRuntime constructor() : Annotation
|
@Retention(value = AnnotationRetention.RUNTIME) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoRuntime constructor() : Annotation
|
||||||
@Retention(value = AnnotationRetention.SOURCE) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoSource constructor() : Annotation
|
@Retention(value = AnnotationRetention.SOURCE) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoSource constructor() : Annotation
|
||||||
fun withBinaryAnnotation(id: @AnnoBinary Int)
|
fun withBinaryAnnotation(id: @AnnoBinary Int)
|
||||||
fun withRuntimeAnnotation(id: @AnnoRuntime Int)
|
fun withRuntimeAnnotation(id: @AnnoRuntime Int)
|
||||||
fun withSourceAnnotation(id: Int)
|
fun withSourceAnnotation(id: Int)
|
||||||
|
}
|
||||||
+72
@@ -23,6 +23,12 @@ import java.util.regex.Pattern;
|
|||||||
@Tag("frontend-fir")
|
@Tag("frontend-fir")
|
||||||
@FirPipeline()
|
@FirPipeline()
|
||||||
public class FirNativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDumpMetadataTest {
|
public class FirNativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDumpMetadataTest {
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Accessors.kt")
|
||||||
|
public void testAccessors() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Accessors.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllFilesPresentInDump_metadata() throws Exception {
|
public void testAllFilesPresentInDump_metadata() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klib/dump-metadata"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klib/dump-metadata"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
||||||
@@ -40,12 +46,36 @@ public class FirNativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDu
|
|||||||
runTest("native/native.tests/testData/klib/dump-metadata/annotations_source_retention.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/annotations_source_retention.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Classes.kt")
|
||||||
|
public void testClasses() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Classes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Constructors.kt")
|
||||||
|
public void testConstructors() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Constructors.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("data_class.kt")
|
@TestMetadata("data_class.kt")
|
||||||
public void testData_class() throws Exception {
|
public void testData_class() throws Exception {
|
||||||
runTest("native/native.tests/testData/klib/dump-metadata/data_class.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/data_class.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Enum.kt")
|
||||||
|
public void testEnum() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Enum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("FunctionModifiers.kt")
|
||||||
|
public void testFunctionModifiers() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/FunctionModifiers.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt55464_serializeTypeAnnotation.kt")
|
@TestMetadata("kt55464_serializeTypeAnnotation.kt")
|
||||||
public void testKt55464_serializeTypeAnnotation() throws Exception {
|
public void testKt55464_serializeTypeAnnotation() throws Exception {
|
||||||
@@ -58,12 +88,54 @@ public class FirNativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDu
|
|||||||
runTest("native/native.tests/testData/klib/dump-metadata/kt56018_value_parameters_annotations.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/kt56018_value_parameters_annotations.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("MethodModality.kt")
|
||||||
|
public void testMethodModality() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/MethodModality.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Objects.kt")
|
||||||
|
public void testObjects() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Objects.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("property_accessors.kt")
|
@TestMetadata("property_accessors.kt")
|
||||||
public void testProperty_accessors() throws Exception {
|
public void testProperty_accessors() throws Exception {
|
||||||
runTest("native/native.tests/testData/klib/dump-metadata/property_accessors.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/property_accessors.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelFunctions.kt")
|
||||||
|
public void testTopLevelFunctions() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelFunctions.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesCustomPackage.kt")
|
||||||
|
public void testTopLevelPropertiesCustomPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesCustomPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesRootPackage.kt")
|
||||||
|
public void testTopLevelPropertiesRootPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesRootPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesWithClassesCustomPackage.kt")
|
||||||
|
public void testTopLevelPropertiesWithClassesCustomPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesWithClassesCustomPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesWithClassesRootPackage.kt")
|
||||||
|
public void testTopLevelPropertiesWithClassesRootPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesWithClassesRootPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("type_annotations.kt")
|
@TestMetadata("type_annotations.kt")
|
||||||
public void testType_annotations() throws Exception {
|
public void testType_annotations() throws Exception {
|
||||||
|
|||||||
+72
@@ -19,6 +19,12 @@ import java.util.regex.Pattern;
|
|||||||
@TestMetadata("native/native.tests/testData/klib/dump-metadata")
|
@TestMetadata("native/native.tests/testData/klib/dump-metadata")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
public class NativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDumpMetadataTest {
|
public class NativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDumpMetadataTest {
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Accessors.kt")
|
||||||
|
public void testAccessors() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Accessors.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllFilesPresentInDump_metadata() throws Exception {
|
public void testAllFilesPresentInDump_metadata() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klib/dump-metadata"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klib/dump-metadata"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
||||||
@@ -36,12 +42,36 @@ public class NativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDumpM
|
|||||||
runTest("native/native.tests/testData/klib/dump-metadata/annotations_source_retention.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/annotations_source_retention.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Classes.kt")
|
||||||
|
public void testClasses() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Classes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Constructors.kt")
|
||||||
|
public void testConstructors() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Constructors.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("data_class.kt")
|
@TestMetadata("data_class.kt")
|
||||||
public void testData_class() throws Exception {
|
public void testData_class() throws Exception {
|
||||||
runTest("native/native.tests/testData/klib/dump-metadata/data_class.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/data_class.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Enum.kt")
|
||||||
|
public void testEnum() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Enum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("FunctionModifiers.kt")
|
||||||
|
public void testFunctionModifiers() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/FunctionModifiers.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt55464_serializeTypeAnnotation.kt")
|
@TestMetadata("kt55464_serializeTypeAnnotation.kt")
|
||||||
public void testKt55464_serializeTypeAnnotation() throws Exception {
|
public void testKt55464_serializeTypeAnnotation() throws Exception {
|
||||||
@@ -54,12 +84,54 @@ public class NativeKlibDumpMetadataTestGenerated extends AbstractNativeKlibDumpM
|
|||||||
runTest("native/native.tests/testData/klib/dump-metadata/kt56018_value_parameters_annotations.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/kt56018_value_parameters_annotations.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("MethodModality.kt")
|
||||||
|
public void testMethodModality() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/MethodModality.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("Objects.kt")
|
||||||
|
public void testObjects() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/Objects.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("property_accessors.kt")
|
@TestMetadata("property_accessors.kt")
|
||||||
public void testProperty_accessors() throws Exception {
|
public void testProperty_accessors() throws Exception {
|
||||||
runTest("native/native.tests/testData/klib/dump-metadata/property_accessors.kt");
|
runTest("native/native.tests/testData/klib/dump-metadata/property_accessors.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelFunctions.kt")
|
||||||
|
public void testTopLevelFunctions() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelFunctions.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesCustomPackage.kt")
|
||||||
|
public void testTopLevelPropertiesCustomPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesCustomPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesRootPackage.kt")
|
||||||
|
public void testTopLevelPropertiesRootPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesRootPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesWithClassesCustomPackage.kt")
|
||||||
|
public void testTopLevelPropertiesWithClassesCustomPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesWithClassesCustomPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TopLevelPropertiesWithClassesRootPackage.kt")
|
||||||
|
public void testTopLevelPropertiesWithClassesRootPackage() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/klib/dump-metadata/TopLevelPropertiesWithClassesRootPackage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("type_annotations.kt")
|
@TestMetadata("type_annotations.kt")
|
||||||
public void testType_annotations() throws Exception {
|
public void testType_annotations() throws Exception {
|
||||||
|
|||||||
+26
-7
@@ -34,8 +34,11 @@ abstract class AbstractNativeKlibDumpMetadataTest : AbstractNativeSimpleTest() {
|
|||||||
|
|
||||||
val kotlinNativeClassLoader = testRunSettings.get<KotlinNativeClassLoader>()
|
val kotlinNativeClassLoader = testRunSettings.get<KotlinNativeClassLoader>()
|
||||||
val metadata = testCompilationResult.assertSuccess().resultingArtifact.dumpMetadata(kotlinNativeClassLoader.classLoader)
|
val metadata = testCompilationResult.assertSuccess().resultingArtifact.dumpMetadata(kotlinNativeClassLoader.classLoader)
|
||||||
val metadataFiltered = filterContentsOutput(metadata, linestoExclude = listOf("package test {", "}", ""))
|
val metadataFiltered = filterOutput(metadata)
|
||||||
assertEqualsToFile(File("${testPathFull.canonicalPath.substringBeforeLast(".")}.txt"), StringUtilRt.convertLineSeparators(metadataFiltered))
|
assertEqualsToFile(
|
||||||
|
File("${testPathFull.canonicalPath.substringBeforeLast(".")}.txt"),
|
||||||
|
StringUtilRt.convertLineSeparators(metadataFiltered)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateTestCaseWithSingleSource(source: File, extraArgs: List<String>): TestCase {
|
private fun generateTestCaseWithSingleSource(source: File, extraArgs: List<String>): TestCase {
|
||||||
@@ -56,9 +59,25 @@ abstract class AbstractNativeKlibDumpMetadataTest : AbstractNativeSimpleTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun filterContentsOutput(contents: String, linestoExclude: List<String>) =
|
// Remove intermediate "}\n\npackage ABC {\n" parts.
|
||||||
contents.lines()
|
private fun filterOutput(contents: String): String {
|
||||||
.filterNot { line ->
|
var packageLineMet = false
|
||||||
linestoExclude.any { exclude -> exclude == line }
|
return contents.lineSequence()
|
||||||
}.joinToString(separator = "\n")
|
.dropWhile { line -> line.isBlank() }
|
||||||
|
.filter { line ->
|
||||||
|
when {
|
||||||
|
line.isBlank() -> false
|
||||||
|
line.startsWith("package ") -> {
|
||||||
|
if (packageLineMet)
|
||||||
|
false
|
||||||
|
else {
|
||||||
|
packageLineMet = true
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
line == "}" -> false
|
||||||
|
else -> true
|
||||||
|
}
|
||||||
|
}.joinToString(separator = "\n", postfix = "\n}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user