K2: support implicit integer to unsigned conversions...
with dedicated opt-in language feature and special annotation or module capability. Not intended for a general use, solves specific K/N scenario with interop libs. #KT-55902 fixed
This commit is contained in:
committed by
Space Team
parent
3e2f8b834c
commit
be2a85be71
Vendored
+12
-11
@@ -35,6 +35,7 @@ fun takeUShort(@ImplicitIntegerCoercion u: UShort) {}
|
||||
fun takeUInt(@ImplicitIntegerCoercion u: UInt) {}
|
||||
fun takeULong(@ImplicitIntegerCoercion u: ULong) {}
|
||||
|
||||
@ExperimentalUnsignedTypes
|
||||
fun takeUBytes(@ImplicitIntegerCoercion vararg u: <!OPT_IN_USAGE!>UByte<!>) {}
|
||||
|
||||
fun takeLong(@ImplicitIntegerCoercion l: Long) {}
|
||||
@@ -44,27 +45,27 @@ fun takeUIntWithoutAnnotaion(u: UInt) {}
|
||||
fun takeIntWithoutAnnotation(i: Int) {}
|
||||
|
||||
fun test() {
|
||||
takeUByte(<!ARGUMENT_TYPE_MISMATCH!>IMPLICIT_INT<!>)
|
||||
takeUByte(<!ARGUMENT_TYPE_MISMATCH!>EXPLICIT_INT<!>)
|
||||
takeUByte(IMPLICIT_INT)
|
||||
takeUByte(EXPLICIT_INT)
|
||||
|
||||
takeUShort(<!ARGUMENT_TYPE_MISMATCH!>IMPLICIT_INT<!>)
|
||||
takeUShort(<!ARGUMENT_TYPE_MISMATCH!>BIGGER_THAN_UBYTE<!>)
|
||||
takeUShort(IMPLICIT_INT)
|
||||
takeUShort(BIGGER_THAN_UBYTE)
|
||||
|
||||
takeUInt(<!ARGUMENT_TYPE_MISMATCH!>IMPLICIT_INT<!>)
|
||||
takeUInt(IMPLICIT_INT)
|
||||
|
||||
takeULong(<!ARGUMENT_TYPE_MISMATCH!>IMPLICIT_INT<!>)
|
||||
takeULong(IMPLICIT_INT)
|
||||
|
||||
<!OPT_IN_USAGE!>takeUBytes<!>(<!ARGUMENT_TYPE_MISMATCH!>IMPLICIT_INT<!>, <!ARGUMENT_TYPE_MISMATCH!>EXPLICIT_INT<!>, 42u)
|
||||
<!OPT_IN_USAGE!>takeUBytes<!>(IMPLICIT_INT, EXPLICIT_INT, 42u)
|
||||
|
||||
takeLong(<!ARGUMENT_TYPE_MISMATCH!>IMPLICIT_INT<!>)
|
||||
takeLong(IMPLICIT_INT)
|
||||
|
||||
takeIntWithoutAnnotation(IMPLICIT_INT)
|
||||
|
||||
takeUIntWithoutAnnotaion(UINT_CONST)
|
||||
|
||||
takeUByte(<!ARGUMENT_TYPE_MISMATCH!>LONG_CONST<!>)
|
||||
takeUByte(LONG_CONST)
|
||||
takeUByte(<!ARGUMENT_TYPE_MISMATCH!>NON_CONST<!>)
|
||||
takeUByte(<!ARGUMENT_TYPE_MISMATCH!>BIGGER_THAN_UBYTE<!>)
|
||||
takeUByte(<!ARGUMENT_TYPE_MISMATCH!>UINT_CONST<!>)
|
||||
takeUByte(BIGGER_THAN_UBYTE)
|
||||
takeUByte(UINT_CONST)
|
||||
takeUIntWithoutAnnotaion(<!ARGUMENT_TYPE_MISMATCH!>IMPLICIT_INT<!>)
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -35,6 +35,7 @@ fun takeUShort(@ImplicitIntegerCoercion u: UShort) {}
|
||||
fun takeUInt(@ImplicitIntegerCoercion u: UInt) {}
|
||||
fun takeULong(@ImplicitIntegerCoercion u: ULong) {}
|
||||
|
||||
@ExperimentalUnsignedTypes
|
||||
fun takeUBytes(@ImplicitIntegerCoercion vararg u: UByte) {}
|
||||
|
||||
fun takeLong(@ImplicitIntegerCoercion l: Long) {}
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ package
|
||||
public fun takeIntWithoutAnnotation(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||
public fun takeLong(/*0*/ @kotlin.internal.ImplicitIntegerCoercion l: kotlin.Long): kotlin.Unit
|
||||
public fun takeUByte(/*0*/ @kotlin.internal.ImplicitIntegerCoercion u: kotlin.UByte): kotlin.Unit
|
||||
public fun takeUBytes(/*0*/ @kotlin.internal.ImplicitIntegerCoercion vararg u: kotlin.UByte /*kotlin.UByteArray*/): kotlin.Unit
|
||||
@kotlin.ExperimentalUnsignedTypes public fun takeUBytes(/*0*/ @kotlin.internal.ImplicitIntegerCoercion vararg u: kotlin.UByte /*kotlin.UByteArray*/): kotlin.Unit
|
||||
public fun takeUInt(/*0*/ @kotlin.internal.ImplicitIntegerCoercion u: kotlin.UInt): kotlin.Unit
|
||||
public fun takeUIntWithoutAnnotaion(/*0*/ u: kotlin.UInt): kotlin.Unit
|
||||
public fun takeULong(/*0*/ @kotlin.internal.ImplicitIntegerCoercion u: kotlin.ULong): kotlin.Unit
|
||||
|
||||
Reference in New Issue
Block a user