KT-16666 IMPLICIT_INTEGER_COERCION expression should have non-nullable type

This commit is contained in:
Dmitry Petrov
2017-03-06 16:17:59 +03:00
parent 8c32719f3d
commit e4683a1e9f
2 changed files with 4 additions and 4 deletions
@@ -184,7 +184,7 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns): IrElementTransformerVoi
KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType.makeNotNullable(), expectedType) ->
this
KotlinBuiltIns.isInt(valueType) && notNullableExpectedType.isBuiltInIntegerType() ->
IrTypeOperatorCallImpl(startOffset, endOffset, expectedType,
IrTypeOperatorCallImpl(startOffset, endOffset, notNullableExpectedType,
IrTypeOperator.IMPLICIT_INTEGER_COERCION, notNullableExpectedType, this)
else ->
IrTypeOperatorCallImpl(startOffset, endOffset, expectedType,
@@ -64,15 +64,15 @@ FILE /primitivesImplicitConversions.kt
VAR val test4: kotlin.Long? = -1.toLong()
CONST Long type=kotlin.Long value='-1'
VAR val test5: kotlin.Long? = -1.toLong()
TYPE_OP type=kotlin.Long? origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long
TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long
CALL 'unaryMinus(): Int' type=kotlin.Int origin=null
$this: CONST Int type=kotlin.Int value='1'
VAR val test6: kotlin.Short? = -1.toShort()
TYPE_OP type=kotlin.Short? origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Short
TYPE_OP type=kotlin.Short origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Short
CALL 'unaryMinus(): Int' type=kotlin.Int origin=null
$this: CONST Int type=kotlin.Int value='1'
VAR val test7: kotlin.Byte? = -1.toByte()
TYPE_OP type=kotlin.Byte? origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Byte
TYPE_OP type=kotlin.Byte origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Byte
CALL 'unaryMinus(): Int' type=kotlin.Int origin=null
$this: CONST Int type=kotlin.Int value='1'
FUN public fun testImplicitArguments(x: kotlin.Long = ...): kotlin.Unit