Files
kotlin-fork/compiler/testData/codegen/box/inlineClasses/callableReferences/inlineClassPrimaryConstructorGeneric.kt
T
2022-02-15 08:11:10 +01:00

20 lines
507 B
Kotlin
Vendored

// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
OPTIONAL_JVM_INLINE_ANNOTATION
value class Z<T: Int>(val x: T)
OPTIONAL_JVM_INLINE_ANNOTATION
value class L<T: Long>(val x: T)
OPTIONAL_JVM_INLINE_ANNOTATION
value class S<T: String>(val x: T)
fun box(): String {
if (42.let(::Z).x != 42) throw AssertionError()
if (1234L.let(::L).x != 1234L) throw AssertionError()
if ("abcdef".let(::S).x != "abcdef") throw AssertionError()
return "OK"
}