'?:' (currently represented as binary expression with operator ELVIS)
This commit is contained in:
committed by
Dmitry Petrov
parent
0d94c3aeb4
commit
8de21aadfa
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
fun test1(a: Any?, b: Any) = a ?: b
|
||||
fun test2(a: String?, b: Any) = a ?: b
|
||||
|
||||
fun test3(a: Any?, b: Any?): String {
|
||||
if (b !is String) return ""
|
||||
if (a !is String?) return ""
|
||||
return a ?: b
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
IrFile /elvis.kt
|
||||
IrFunction public fun test1(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any): kotlin.Any
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
BINARY_OP operator=ELVIS type=kotlin.Any related=null
|
||||
GET_VAR a type=kotlin.Any?
|
||||
GET_VAR b type=kotlin.Any
|
||||
IrFunction public fun test2(/*0*/ a: kotlin.String?, /*1*/ b: kotlin.Any): kotlin.Any
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=true
|
||||
RETURN type=<no-type>
|
||||
BINARY_OP operator=ELVIS type=kotlin.Any related=null
|
||||
GET_VAR a type=kotlin.String?
|
||||
GET_VAR b type=kotlin.Any
|
||||
IrFunction public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.String
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false isDesugared=false
|
||||
DUMMY KtIfExpression type=kotlin.Unit
|
||||
DUMMY KtIfExpression type=kotlin.Unit
|
||||
RETURN type=<no-type>
|
||||
BINARY_OP operator=ELVIS type=kotlin.String related=null
|
||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String?
|
||||
GET_VAR a type=kotlin.Any?
|
||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR b type=kotlin.Any?
|
||||
Reference in New Issue
Block a user