KT-36963 Deparenthesize !! argument when generating expression

This commit is contained in:
Dmitry Petrov
2020-03-06 12:01:00 +03:00
parent 71e4b0c9ad
commit eba45d4f89
6 changed files with 44 additions and 11 deletions
@@ -0,0 +1,9 @@
FILE fqName:<root> fileName:/kt36963.kt
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0<kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.reflect.KFunction0<kotlin.Unit> declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.reflect.KFunction0<kotlin.Unit>
arg0: FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
+3
View File
@@ -0,0 +1,3 @@
fun foo() {}
fun test() = (::foo)!!
+9
View File
@@ -0,0 +1,9 @@
FILE fqName:<root> fileName:/kt36963.kt
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
FUN name:test visibility:public modality:FINAL <> () returnType:IrErrorType
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): IrErrorType declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.reflect.KFunction0<kotlin.Unit>
arg0: FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>