'!!' operator

This commit is contained in:
Dmitry Petrov
2016-08-26 17:31:02 +03:00
committed by Dmitry Petrov
parent 92a7ecfac7
commit 57c1b3e0e2
5 changed files with 64 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
fun test1(a: Any?) = a!!
fun test2(a: Any?) = a?.hashCode()!!
+28
View File
@@ -0,0 +1,28 @@
FILE /bangbang.kt
FUN public fun test1(/*0*/ a: kotlin.Any?): kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from=test1
WHEN type=kotlin.Any operator=null
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
arg0: GET_VAR a type=kotlin.Any? operator=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CALL .THROW_NPE type=kotlin.Nothing operator=EXCLEXCL
else: GET_VAR a type=kotlin.Any? operator=null
FUN public fun test2(/*0*/ a: kotlin.Any?): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=test2
BLOCK type=kotlin.Int operator=EXCLEXCL
VAR val tmp1_notnull: kotlin.Int?
WHEN type=kotlin.Int? operator=SAFE_CALL
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
arg0: GET_VAR a type=kotlin.Any? operator=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL .hashCode type=kotlin.Int operator=null
$this: GET_VAR a type=kotlin.Any? operator=null
WHEN type=kotlin.Int operator=null
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
arg0: GET_VAR tmp1_notnull type=kotlin.Int? operator=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CALL .THROW_NPE type=kotlin.Nothing operator=EXCLEXCL
else: GET_VAR tmp1_notnull type=kotlin.Int? operator=null