Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ fun deserializeClassToSymbol(
context.typeTable,
context.typeDeserializer::rigidType,
) { name ->
val member = declarations.singleOrNull { it is FirProperty && it.receiverParameter == null && it.name == name }
val member = declarations.singleOrNull { it is FirProperty && it.receiverParameter == null && it.contextParameters.isEmpty() && it.name == name }
(member as FirProperty?)?.returnTypeRef?.coneType as ConeRigidType
} ?: computeValueClassRepresentation(this, session)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// ISSUE: KT-87290
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ContextParameters

// MODULE: lib
// FILE: lib.kt
OPTIONAL_JVM_INLINE_ANNOTATION
value class Wrapper(val value: Int) {
context(prefix: String)
val value: String
get() = prefix
}

OPTIONAL_JVM_INLINE_ANNOTATION
value class Wrapper1(val value: Int) {
context(prefix: String)
private val value: String
get() = prefix
}

OPTIONAL_JVM_INLINE_ANNOTATION
value class Wrapper2(private val value: Int) {
context(prefix: String)
val value: String
get() = prefix
}

// MODULE: main(lib)
// FILE: main.kt
fun box(): String {
val w0 = Wrapper(42)
if (w0.value != 42) return w0.value.toString()

val w1 = Wrapper1(42)
if (w1.value != 42) return w1.value.toString()
val w2 = Wrapper2(42)

context("SOME") {
if (w1.value != 42) return w1.value.toString()
if (w2.value != "SOME") return w2.value
}

return "OK"
}