Type operators.

This commit is contained in:
Dmitry Petrov
2016-08-19 11:33:44 +03:00
committed by Dmitry Petrov
parent 5709826096
commit d6040d8570
9 changed files with 135 additions and 57 deletions
+4 -2
View File
@@ -17,11 +17,13 @@ IrFile /elvis.kt
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
WHEN subject=null type=kotlin.Unit
if: DUMMY KtIsExpression type=kotlin.Boolean
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR b type=kotlin.Any? operator=null
then: RETURN type=<no-type>
LITERAL String type=kotlin.String value=''
WHEN subject=null type=kotlin.Unit
if: DUMMY KtIsExpression type=kotlin.Boolean
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String?
GET_VAR a type=kotlin.Any? operator=null
then: RETURN type=<no-type>
LITERAL String type=kotlin.String value=''
RETURN type=<no-type>
+6 -3
View File
@@ -19,7 +19,8 @@ IrFile /smartCasts.kt
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
WHEN subject=null type=kotlin.Unit
if: DUMMY KtIsExpression type=kotlin.Boolean
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR x type=kotlin.Any operator=null
then: RETURN type=<no-type>
CALL .println type=kotlin.Unit operator=null
message: GET_PROPERTY .length type=kotlin.Int operator=null
@@ -40,7 +41,8 @@ IrFile /smartCasts.kt
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
WHEN subject=null type=kotlin.Unit
if: DUMMY KtIsExpression type=kotlin.Boolean
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR x type=kotlin.Any operator=null
then: RETURN type=<no-type>
LITERAL String type=kotlin.String value=''
RETURN type=<no-type>
@@ -51,7 +53,8 @@ IrFile /smartCasts.kt
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
WHEN subject=null type=kotlin.Unit
if: DUMMY KtIsExpression type=kotlin.Boolean
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR x type=kotlin.Any operator=null
then: RETURN type=<no-type>
LITERAL String type=kotlin.String value=''
RETURN type=<no-type>
@@ -15,7 +15,8 @@ IrFile /smartCastsWithDestructuring.kt
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
WHEN subject=null type=kotlin.Unit
if: DUMMY KtIsExpression type=kotlin.Boolean
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=I2
GET_VAR x type=I1 operator=null
then: RETURN type=<no-type>
BLOCK type=<no-type> hasResult=false operator=SYNTHETIC_BLOCK
VAR val tmp0: I1
+6
View File
@@ -0,0 +1,6 @@
interface IThing
fun test1(x: Any) = x is IThing
fun test2(x: Any) = x !is IThing
fun test3(x: Any) = x as IThing
fun test4(x: Any) = x as? IThing
+26
View File
@@ -0,0 +1,26 @@
IrFile /typeOperators.kt
DUMMY IThing
IrFunction public fun test1(/*0*/ x: kotlin.Any): kotlin.Boolean
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
TYPE_OP operator=INSTANCEOF typeOperand=IThing
GET_VAR x type=kotlin.Any operator=null
IrFunction public fun test2(/*0*/ x: kotlin.Any): kotlin.Boolean
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
TYPE_OP operator=NOT_INSTANCEOF typeOperand=IThing
GET_VAR x type=kotlin.Any operator=null
IrFunction public fun test3(/*0*/ x: kotlin.Any): IThing
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
TYPE_OP operator=CAST typeOperand=IThing
GET_VAR x type=kotlin.Any operator=null
IrFunction public fun test4(/*0*/ x: kotlin.Any): IThing?
IrExpressionBody
BLOCK type=<no-type> hasResult=false operator=null
RETURN type=<no-type>
TYPE_OP operator=SAFE_CAST typeOperand=IThing
GET_VAR x type=kotlin.Any operator=null