[K2] Enable tests for hasConstant field on properties in metadata.

This commit is contained in:
Mads Ager
2023-03-14 16:24:34 +01:00
committed by Mikhail Glukhikh
parent f7171f01ae
commit 1f3b8142a8
6 changed files with 65 additions and 3 deletions
@@ -858,7 +858,7 @@ class FirElementSerializer private constructor(
}
}
}
private fun fillFromPossiblyInnerType(builder: ProtoBuf.Type.Builder, type: ConeClassLikeType) {
val classifierSymbol = type.lookupTag.toSymbol(session)
if (classifierSymbol != null) {
@@ -34,6 +34,11 @@ public class K1KotlinpTestGenerated extends AbstractK1KotlinpTest {
runTest("libraries/tools/kotlinp/testData/Annotations.kt");
}
@TestMetadata("Constants.kt")
public void testConstants() throws Exception {
runTest("libraries/tools/kotlinp/testData/Constants.kt");
}
@TestMetadata("ContextReceivers.kt")
public void testContextReceivers() throws Exception {
runTest("libraries/tools/kotlinp/testData/ContextReceivers.kt");
@@ -34,6 +34,11 @@ public class K2KotlinpTestGenerated extends AbstractK2KotlinpTest {
runTest("libraries/tools/kotlinp/testData/Annotations.kt");
}
@TestMetadata("Constants.kt")
public void testConstants() throws Exception {
runTest("libraries/tools/kotlinp/testData/Constants.kt");
}
@TestMetadata("ContextReceivers.kt")
public void testContextReceivers() throws Exception {
runTest("libraries/tools/kotlinp/testData/ContextReceivers.kt");
+8
View File
@@ -0,0 +1,8 @@
class A {
val constantString: String = "OK"
val constantInt: Int = 12
val constantDouble: Double = 1.0
val constantNull: String? = null
}
const val four = 2 + 2
+46
View File
@@ -0,0 +1,46 @@
// A.class
// ------------------------------------------
public final class A : kotlin/Any {
// signature: <init>()V
public constructor()
// field: constantDouble:D
// getter: getConstantDouble()D
public final val constantDouble: kotlin/Double /* = ... */
public final get
// field: constantInt:I
// getter: getConstantInt()I
public final val constantInt: kotlin/Int /* = ... */
public final get
// field: constantNull:Ljava/lang/String;
// getter: getConstantNull()Ljava/lang/String;
public final val constantNull: kotlin/String?
public final get
// field: constantString:Ljava/lang/String;
// getter: getConstantString()Ljava/lang/String;
public final val constantString: kotlin/String /* = ... */
public final get
// module name: test-module
}
// ConstantsKt.class
// ------------------------------------------
package {
// field: four:I
public final const val four: kotlin/Int /* = ... */
public final get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
ConstantsKt
}
}
@@ -1,5 +1,3 @@
// IGNORE K2
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package test