Analysis attempt #0
KT element: KtCallExpression
KT element text:
consume(1)
FIR element: FirFunctionCallImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
R|/consume|(Int(1))

FIR FILE:
FILE: [ResolvedTo(IMPORTS)] function.kts
    SCRIPT: [ResolvedTo(TYPES)] <script-function.kts>
        [ResolvedTo(TYPES)] <script receiver parameter>: R|kotlin/script/templates/standard/ScriptTemplateWithArgs|
        [ResolvedTo(TYPES)] lval args: R|kotlin/Array<kotlin/String>|

        public final [ResolvedTo(STATUS)] [ScriptTopLevelDeclaration=true] fun consume([ResolvedTo(STATUS)] a: R|kotlin/Any|): R|kotlin/Any| { LAZY_BLOCK }

        public final [ResolvedTo(ANNOTATION_ARGUMENTS)] [PartialBodyAnalysisStateKey=1(1/4) #1, ScriptTopLevelDeclaration=true] fun test([ResolvedTo(ANNOTATION_ARGUMENTS)] foo: R|broken/lib/Foo|): R|kotlin/Unit| {
            R|/consume|(Int(1))
            when () {
                CMP(>, a#.compareTo#(IntegerLiteral(2))) ->  {
                    consume#(foo#.result#)
                }
            }

            when () {
                CMP(>, a#.compareTo#(IntegerLiteral(3))) ->  {
                    consume#(IntegerLiteral(3))
                }
            }

            consume#(IntegerLiteral(4))
        }

        [ResolvedTo(RAW_FIR)] [ScriptTopLevelDeclaration=true] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] [ScriptTopLevelDeclaration=true] init { LAZY_BLOCK }

        public final [ResolvedTo(RAW_FIR)] val $$result: <implicit> = consume#(LAZY_EXPRESSION)
            public [ResolvedTo(RAW_FIR)] get(): <implicit>

=====

Analysis attempt #1
KT element: KtIfExpression
KT element text:
if (a > 2) {
        consume(foo.result)
    }
FIR element: null
FIR source kind: null

FIR element rendered:
null

FIR FILE:
FILE: [ResolvedTo(IMPORTS)] function.kts
    SCRIPT: [ResolvedTo(TYPES)] <script-function.kts>
        [ResolvedTo(TYPES)] <script receiver parameter>: R|kotlin/script/templates/standard/ScriptTemplateWithArgs|
        [ResolvedTo(TYPES)] lval args: R|kotlin/Array<kotlin/String>|

        public final [ResolvedTo(STATUS)] [ScriptTopLevelDeclaration=true] fun consume([ResolvedTo(STATUS)] a: R|kotlin/Any|): R|kotlin/Any| { LAZY_BLOCK }

        public final [ResolvedTo(ANNOTATION_ARGUMENTS)] [PartialBodyAnalysisStateKey=1(1/4) #1, ScriptTopLevelDeclaration=true] fun test([ResolvedTo(ANNOTATION_ARGUMENTS)] foo: R|broken/lib/Foo|): R|kotlin/Unit| {
            R|/consume|(Int(1))
            when () {
                CMP(>, a#.compareTo#(IntegerLiteral(2))) ->  {
                    consume#(foo#.result#)
                }
            }

            when () {
                CMP(>, a#.compareTo#(IntegerLiteral(3))) ->  {
                    consume#(IntegerLiteral(3))
                }
            }

            consume#(IntegerLiteral(4))
        }

        [ResolvedTo(RAW_FIR)] [ScriptTopLevelDeclaration=true] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] [ScriptTopLevelDeclaration=true] init { LAZY_BLOCK }

        public final [ResolvedTo(RAW_FIR)] val $$result: <implicit> = consume#(LAZY_EXPRESSION)
            public [ResolvedTo(RAW_FIR)] get(): <implicit>

=====

Analysis attempt #2
KT element: KtIfExpression
KT element text:
if (a > 3) {
        consume(3)
    }
FIR element: FirWhenExpressionImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
when () {
    CMP(>, <Unresolved name: a>#.<Unresolved name: compareTo>#(Int(3))) ->  {
        R|/consume|(Int(3))
    }
}

FIR FILE:
FILE: [ResolvedTo(IMPORTS)] function.kts
    SCRIPT: [ResolvedTo(TYPES)] <script-function.kts>
        [ResolvedTo(TYPES)] <script receiver parameter>: R|kotlin/script/templates/standard/ScriptTemplateWithArgs|
        [ResolvedTo(TYPES)] lval args: R|kotlin/Array<kotlin/String>|

        public final [ResolvedTo(STATUS)] [ScriptTopLevelDeclaration=true] fun consume([ResolvedTo(STATUS)] a: R|kotlin/Any|): R|kotlin/Any| { LAZY_BLOCK }

        public final [ResolvedTo(ANNOTATION_ARGUMENTS)] [PartialBodyAnalysisStateKey=3(3/4) #2, ScriptTopLevelDeclaration=true] fun test([ResolvedTo(ANNOTATION_ARGUMENTS)] foo: R|broken/lib/Foo|): R|kotlin/Unit| {
            R|/consume|(Int(1))
            when () {
                CMP(>, <Unresolved name: a>#.<Unresolved name: compareTo>#(Int(2))) ->  {
                    R|/consume|(R|<local>/foo|.R|broken/lib/Foo.result|)
                }
            }

            when () {
                CMP(>, <Unresolved name: a>#.<Unresolved name: compareTo>#(Int(3))) ->  {
                    R|/consume|(Int(3))
                }
            }

            consume#(IntegerLiteral(4))
        }

        [ResolvedTo(RAW_FIR)] [ScriptTopLevelDeclaration=true] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] [ScriptTopLevelDeclaration=true] init { LAZY_BLOCK }

        public final [ResolvedTo(RAW_FIR)] val $$result: <implicit> = consume#(LAZY_EXPRESSION)
            public [ResolvedTo(RAW_FIR)] get(): <implicit>