Write is_unsigned flag into metadata for an annotation arguments

Instead of adding new kind of types, we'll use flag to disambiguate
 usual types from unsigned ones, this approach has two advantages:
 - less changes in the metadata format
 - it allows naturally extend format for unsigned arrays,
  which will be supported later

 #KT-25310 Fixed
 #KT-25273 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-07-06 01:41:13 +03:00
parent 8c075bc622
commit 0c6757a8b0
13 changed files with 487 additions and 169 deletions
@@ -0,0 +1,16 @@
// WITH_UNSIGNED
package test
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER)
annotation class Ann(
val ubyte: UByte,
val ushort: UShort,
val uint: UInt,
val ulong: ULong
)
class A {
fun unsigned(s: @Ann(1u, 2u, 3u, 4u) String) {}
fun <@Ann(0xFFu, 0xFFFFu, 0xFFFF_FFFFu, 0xFFFF_FFFF_FFFF_FFFFuL) T> typeParam() {}
}
@@ -0,0 +1,19 @@
package test
public final class A {
/*primary*/ public constructor A()
public final fun </*0*/ @test.Ann(ubyte = -1.toUByte(), uint = -1.toUInt(), ulong = -1.toULong(), ushort = -1.toUShort()) T> typeParam(): kotlin.Unit
public final fun unsigned(/*0*/ s: @test.Ann(ubyte = 1.toUByte(), uint = 3.toUInt(), ulong = 4.toULong(), ushort = 2.toUShort()) kotlin.String): kotlin.Unit
}
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class Ann : kotlin.Annotation {
/*primary*/ public constructor Ann(/*0*/ ubyte: kotlin.UByte, /*1*/ ushort: kotlin.UShort, /*2*/ uint: kotlin.UInt, /*3*/ ulong: kotlin.ULong)
public final val ubyte: kotlin.UByte
public final fun <get-ubyte>(): kotlin.UByte
public final val uint: kotlin.UInt
public final fun <get-uint>(): kotlin.UInt
public final val ulong: kotlin.ULong
public final fun <get-ulong>(): kotlin.ULong
public final val ushort: kotlin.UShort
public final fun <get-ushort>(): kotlin.UShort
}