kotlinx-metadata: Fix parsing of inlineClassUnderlyingType

This commit is contained in:
Steven Schäfer
2021-10-13 15:00:00 +02:00
committed by Alexander Udalov
parent 77dde26c7c
commit 4b4ee78e5d
4 changed files with 66 additions and 3 deletions
@@ -9,12 +9,11 @@ import kotlinx.metadata.*
import kotlinx.metadata.jvm.*
import org.jetbrains.org.objectweb.asm.ClassWriter
import org.jetbrains.org.objectweb.asm.Opcodes
import org.junit.Assert.*
import org.junit.Test
import java.net.URLClassLoader
import kotlin.coroutines.CoroutineContext
import kotlin.reflect.full.primaryConstructor
import kotlin.test.assertFailsWith
import kotlin.test.*
class MetadataSmokeTest {
private fun Class<*>.readMetadata(): KotlinClassHeader {
@@ -97,7 +97,7 @@ fun ProtoBuf.Class.accept(
v.visitInlineClassUnderlyingPropertyName(c[inlineClassUnderlyingPropertyName])
}
loadInlineClassUnderlyingType(c)?.let { underlyingType ->
v.visitInlineClassUnderlyingType(underlyingType.flags)?.let { underlyingType.accept(it, c) }
v.visitInlineClassUnderlyingType(underlyingType.typeFlags)?.let { underlyingType.accept(it, c) }
}
for (versionRequirement in versionRequirementList) {
+6
View File
@@ -1,2 +1,8 @@
@JvmInline
value class A(private val i: Int?)
@JvmInline
value class B(private val f: suspend () -> Unit)
@JvmInline
value class Z(val s: String)
+58
View File
@@ -1,3 +1,61 @@
// A.class
// ------------------------------------------
// requires language version 1.3.0 (level=ERROR)
public final value class A : kotlin/Any {
// requires language version 1.3.0 (level=ERROR)
// signature: constructor-impl(Ljava/lang/Integer;)Ljava/lang/Integer;
public constructor(i: kotlin/Int?)
// signature: equals-impl(Ljava/lang/Integer;Ljava/lang/Object;)Z
public open /* synthesized */ operator fun equals(other: kotlin/Any?): kotlin/Boolean
// signature: hashCode-impl(Ljava/lang/Integer;)I
public open /* synthesized */ fun hashCode(): kotlin/Int
// signature: toString-impl(Ljava/lang/Integer;)Ljava/lang/String;
public open /* synthesized */ fun toString(): kotlin/String
// field: i:Ljava/lang/Integer;
private final val i: kotlin/Int?
private final get
// underlying property: i
// underlying type: kotlin/Int?
// module name: test-module
}
// B.class
// ------------------------------------------
// requires language version 1.3.0 (level=ERROR)
public final value class B : kotlin/Any {
// requires language version 1.3.0 (level=ERROR)
// requires language version 1.3.0 (level=ERROR)
// signature: constructor-impl(Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1;
public constructor(f: suspend kotlin/Function1<kotlin/coroutines/Continuation<kotlin/Unit>, kotlin/Any?>)
// signature: equals-impl(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;)Z
public open /* synthesized */ operator fun equals(other: kotlin/Any?): kotlin/Boolean
// signature: hashCode-impl(Lkotlin/jvm/functions/Function1;)I
public open /* synthesized */ fun hashCode(): kotlin/Int
// signature: toString-impl(Lkotlin/jvm/functions/Function1;)Ljava/lang/String;
public open /* synthesized */ fun toString(): kotlin/String
// requires language version 1.3.0 (level=ERROR)
// field: f:Lkotlin/jvm/functions/Function1;
private final val f: suspend kotlin/Function1<kotlin/coroutines/Continuation<kotlin/Unit>, kotlin/Any?>
private final get
// underlying property: f
// underlying type: suspend kotlin/Function1<kotlin/coroutines/Continuation<kotlin/Unit>, kotlin/Any?>
// module name: test-module
}
// Z.class
// ------------------------------------------
// requires language version 1.3.0 (level=ERROR)