[K2/N] Fix property accessors modality in K2 metadata

^KT-56603
This commit is contained in:
Pavel Kunyavskiy
2023-03-16 15:48:44 +01:00
committed by Space Team
parent aa3c189d83
commit b01cc1f88c
8 changed files with 63 additions and 7 deletions
@@ -0,0 +1,23 @@
package test;
abstract class A {
abstract val a: Int
abstract var b: Int
protected set
val c: Int = TODO()
val d: Int
get() = TODO()
var e: Int
get() = TODO()
set(value) = TODO()
var f: Int = TODO()
private set
open val g: Int = TODO()
open val h: Int
get() = TODO()
open var k: Int
get() = TODO()
set(value) = TODO()
open var l: Int = TODO()
protected set
}
@@ -0,0 +1,15 @@
abstract class A constructor() {
abstract val a: Int
abstract var b: Int
protected set
val c: Int
val d: Int
var e: Int
var f: Int
private set
open val g: Int
open val h: Int
open var k: Int
open var l: Int
protected set
}
@@ -53,6 +53,12 @@ public class FirNativeKLibContentsTestGenerated extends AbstractNativeKlibConten
runTest("native/native.tests/testData/klibContents/kt56018_value_parameters_annotations.kt");
}
@Test
@TestMetadata("property_accessors.kt")
public void testProperty_accessors() throws Exception {
runTest("native/native.tests/testData/klibContents/property_accessors.kt");
}
@Test
@TestMetadata("type_annotations.kt")
public void testType_annotations() throws Exception {
@@ -50,6 +50,12 @@ public class K1NativeKLibContentsTestGenerated extends AbstractNativeKlibContent
runTest("native/native.tests/testData/klibContents/kt56018_value_parameters_annotations.kt");
}
@Test
@TestMetadata("property_accessors.kt")
public void testProperty_accessors() throws Exception {
runTest("native/native.tests/testData/klibContents/property_accessors.kt");
}
@Test
@TestMetadata("type_annotations.kt")
public void testType_annotations() throws Exception {
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.runner.*
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.*
import org.jetbrains.kotlin.konan.blackboxtest.support.util.*
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEquals
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEqualsToFile
import org.junit.jupiter.api.Tag
import java.io.File
@@ -31,10 +32,7 @@ abstract class AbstractNativeKlibContentsTest : AbstractNativeSimpleTest() {
val kotlinNativeClassLoader = testRunSettings.get<KotlinNativeClassLoader>()
val klibContents = testCompilationResult.assertSuccess().resultingArtifact.getContents(kotlinNativeClassLoader.classLoader)
val klibContentsFiltered = filterContentsOutput(klibContents, linestoExclude = listOf("package test {", "}", ""))
val expectedContents = File("${testPathFull.canonicalPath.substringBeforeLast(".")}.txt").readText()
assertEquals(StringUtilRt.convertLineSeparators(expectedContents), StringUtilRt.convertLineSeparators(klibContentsFiltered)) {
"Test failed. Compilation result was: $testCompilationResult"
}
assertEqualsToFile(File("${testPathFull.canonicalPath.substringBeforeLast(".")}.txt"), StringUtilRt.convertLineSeparators(klibContentsFiltered))
}
private fun generateTestCaseWithSingleSource(source: File, extraArgs: List<String>): TestCase {