Always generate primitive boolean constants as expressions of type 'kotlin.Boolean'.

This commit is contained in:
Dmitry Petrov
2017-03-06 18:37:34 +03:00
parent 1bbbc1ca1c
commit cb61c358ea
4 changed files with 38 additions and 2 deletions
@@ -0,0 +1,7 @@
fun test1(b: Boolean) {
b && return
}
fun test2(b: Boolean) {
b || return
}
@@ -0,0 +1,23 @@
FILE /booleanConstsInAndAndOrOr.kt
FUN public fun test1(b: kotlin.Boolean): kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null
then: RETURN type=kotlin.Nothing from='test1(Boolean): Unit'
GET_OBJECT 'Unit' type=kotlin.Unit
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST Boolean type=kotlin.Boolean value='false'
FUN public fun test2(b: kotlin.Boolean): kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
WHEN type=kotlin.Boolean origin=OROR
BRANCH
if: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null
then: CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: RETURN type=kotlin.Nothing from='test2(Boolean): Unit'
GET_OBJECT 'Unit' type=kotlin.Unit