Fix mapping of nullable generic underlying types of inline classes
#KT-32162 Fixed
This commit is contained in:
+9
@@ -11,12 +11,17 @@ value class Str<T: String>(val string: T)
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class NStr<T: String?>(val string: T)
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class NStr2<T: String>(val string: T?)
|
||||
|
||||
fun <T: Int> fooZ(x: Z<T>) = x
|
||||
|
||||
fun <T: String> fooStr(x: Str<T>) = x
|
||||
|
||||
fun <T: String?> fooNStr(x: NStr<T>) = x
|
||||
|
||||
fun <T: String> fooNStr2(x: NStr2<T>) = x
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val fnZ: (Z<Int>) -> Z<Int> = ::fooZ
|
||||
@@ -29,5 +34,9 @@ fun box(): String {
|
||||
if (fnNStr.invoke(NStr(null)).string != null) throw AssertionError()
|
||||
if (fnNStr.invoke(NStr("nstr")).string != "nstr") throw AssertionError()
|
||||
|
||||
val fnNStr2: (NStr2<String>) -> NStr2<String> = ::fooNStr2
|
||||
if (fnNStr2.invoke(NStr2(null)).string != null) throw AssertionError()
|
||||
if (fnNStr2.invoke(NStr2("nstr2")).string != "nstr2") throw AssertionError()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user