Fix mapping of nullable generic underlying types of inline classes

#KT-32162 Fixed
This commit is contained in:
Ilmir Usmanov
2022-02-22 00:15:32 +01:00
committed by teamcity
parent 981f8b1871
commit 8811f62300
77 changed files with 3400 additions and 131 deletions
@@ -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"
}