fun box()

in compiler/testData/codegen/box/reflection/callBy/memberExtensionFunWithDefaultAndContextParams.kt [165:320]


fun box(): String {

    var ref: KCallable<*> = findMember(A::class, "member30")

    assertEquals(
        "a_b_42.0_10.0_30.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p1") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_42.0_30.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p10") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_10.0_42.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p30") to 42.0
            )
        )
    )

    ref = findMember(A::class, "member31")

    assertEquals(
        "a_b_42.0_10.0_31.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p1") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_42.0_31.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p10") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_10.0_42.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p31") to 42.0
            )
        )
    )

    ref = findMember(A::class, "member32")

    assertEquals(
        "a_b_42.0_10.0_32.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p1") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_42.0_32.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p10") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_10.0_42.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p32") to 42.0
            )
        )
    )

    ref = findMember(A::class, "member33")

    assertEquals(
        "a_b_42.0_10.0_33.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p1") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_42.0_33.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p10") to 42.0
            )
        )
    )

    assertEquals(
        "a_b_1.0_10.0_42.0",
        ref.callBy(
            mapOf(
                findThisParam(ref) to A(),
                findParam(ref, "x") to "a",
                findExtensionParam(ref) to "b",
                findParam(ref, "p33") to 42.0
            )
        )
    )

    return "OK"
}