Files
kotlin-fork/compiler/testData/codegen/box/inlineClasses/kt27096.kt
T
Mark Punzalan 802beb49a6 Use TypeSubstitutor to get the substituted underlying type for inline
classes, instead of MemberScope.

The primary motivation was to fix issues around type-mapping for inline
classes in FIR, which uses wrapped descriptors that have empty
MemberScopes.
2020-06-04 17:03:55 +03:00

23 lines
628 B
Kotlin
Vendored

// KJS_WITH_FULL_RUNTIME
// !LANGUAGE: +InlineClasses
// WITH_RUNTIME
inline class Ucn(private val i: UInt)
class PPInput(private val s: ByteArray) {
fun peek(n: UInt = 0u): Ucn? =
if (n >= s.size.toUInt())
null
else
Ucn(s[n.toInt()].toUInt())
}
fun box(): String {
val ppInput = PPInput(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
if (ppInput.peek(0u) == null) throw AssertionError()
if (ppInput.peek(100u) != null) throw AssertionError()
if (ppInput.peek(0u)!!.toString() != "Ucn(i=0)") throw AssertionError(ppInput.peek(0u)!!.toString())
return "OK"
}