kotlinx-metadata: add Flag.Type.IS_DEFINITELY_NON_NULL
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## Next
|
||||
|
||||
- kotlinx-metadata-jvm can no longer be used on JVM 1.6, and now requires JVM 1.8 or later.
|
||||
- Add `Flag.Type.IS_DEFINITELY_NON_NULL`.
|
||||
|
||||
## 0.4.2
|
||||
|
||||
|
||||
@@ -459,6 +459,13 @@ class Flag(private val offset: Int, private val bitWidth: Int, private val value
|
||||
*/
|
||||
@JvmField
|
||||
val IS_SUSPEND = Flag(F.SUSPEND_TYPE.offset + 1, F.SUSPEND_TYPE.bitWidth, 1)
|
||||
|
||||
/**
|
||||
* Signifies that the corresponding type is
|
||||
* [definitely non-null](https://kotlinlang.org/docs/whatsnew17.html#stable-definitely-non-nullable-types).
|
||||
*/
|
||||
@JvmField
|
||||
val IS_DEFINITELY_NON_NULL = Flag(F.DEFINITELY_NOT_NULL_TYPE.offset + 1, F.DEFINITELY_NOT_NULL_TYPE.bitWidth, 1)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -369,6 +369,9 @@ private fun printType(flags: Flags, output: (String) -> Unit): KmTypeVisitor =
|
||||
if (Flag.Type.IS_NULLABLE(flags)) {
|
||||
append("?")
|
||||
}
|
||||
if (Flag.Type.IS_DEFINITELY_NON_NULL(flags)) {
|
||||
append(" & Any")
|
||||
}
|
||||
if (abbreviatedType != null) {
|
||||
append(" /* = ").append(abbreviatedType).append(" */")
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ class A<T> {
|
||||
fun <T> a(t: T) {}
|
||||
|
||||
inner class B<U, V : U> {
|
||||
fun <T, U> b(t: T, u: U, v: V) where T : Comparable<T>, T : Cloneable {}
|
||||
fun <T, U> b(t: T, u: U & Any, v: V) where T : Comparable<T>, T : Cloneable {}
|
||||
|
||||
fun bb(t: T) {}
|
||||
|
||||
|
||||
+2
-1
@@ -19,8 +19,9 @@ public final inner class A.B<T#1 /* U */, T#2 /* V */ : T#1> : kotlin/Any {
|
||||
// signature: <init>(LA;)V
|
||||
public constructor()
|
||||
|
||||
// requires language version 1.7.0 (level=ERROR)
|
||||
// signature: b(Ljava/lang/Comparable;Ljava/lang/Object;Ljava/lang/Object;)V
|
||||
public final fun <T#3 /* T */ : kotlin/Comparable<T#3> & kotlin/Cloneable, T#4 /* U */> b(t: T#3, u: T#4, v: T#2): kotlin/Unit
|
||||
public final fun <T#3 /* T */ : kotlin/Comparable<T#3> & kotlin/Cloneable, T#4 /* U */> b(t: T#3, u: T#4 & Any, v: T#2): kotlin/Unit
|
||||
|
||||
// signature: bb(Ljava/lang/Object;)V
|
||||
public final fun bb(t: T#0): kotlin/Unit
|
||||
|
||||
Reference in New Issue
Block a user