Analysis attempt #0
KT element: KtScriptInitializer
KT element text:
foo(3)
FIR element: FirAnonymousInitializerImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
[ResolvedTo(BODY_RESOLVE)] init {
    R|/foo|(Int(3))
}

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

        public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] a: R|kotlin/Int|): R|broken/lib/Foo| { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(BODY_RESOLVE)] init {
            R|/foo|(Int(3))
        }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        public? final? [ResolvedTo(RAW_FIR)] fun bar([ResolvedTo(RAW_FIR)] a: Int): broken.lib.Foo { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

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

=====

Analysis attempt #1
KT element: KtScriptInitializer
KT element text:
foo(2).result
FIR element: null
FIR source kind: null

FIR element rendered:
null

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

        public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] a: R|kotlin/Int|): R|broken/lib/Foo| { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(ANNOTATION_ARGUMENTS)] init { LAZY_BLOCK }

        [ResolvedTo(BODY_RESOLVE)] init {
            R|/foo|(Int(3))
        }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        public? final? [ResolvedTo(RAW_FIR)] fun bar([ResolvedTo(RAW_FIR)] a: Int): broken.lib.Foo { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

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

=====

Analysis attempt #2
KT element: KtScriptInitializer
KT element text:
foo(1)
FIR element: FirAnonymousInitializerImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
[ResolvedTo(BODY_RESOLVE)] init {
    R|/foo|(Int(1))
}

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

        public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] a: R|kotlin/Int|): R|broken/lib/Foo| { LAZY_BLOCK }

        [ResolvedTo(BODY_RESOLVE)] init {
            R|/foo|(Int(1))
        }

        [ResolvedTo(ANNOTATION_ARGUMENTS)] init { LAZY_BLOCK }

        [ResolvedTo(BODY_RESOLVE)] init {
            R|/foo|(Int(3))
        }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        public? final? [ResolvedTo(RAW_FIR)] fun bar([ResolvedTo(RAW_FIR)] a: Int): broken.lib.Foo { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

        [ResolvedTo(RAW_FIR)] init { LAZY_BLOCK }

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