Skip to content

Unable to resolve lambda type parameters with context parameters #2702

@ForteScarlet

Description

@ForteScarlet

Hi!
For example:

fun complexContextFunction(block: context(String, Int) StringBuilder.(Boolean) -> Unit) {
    context("Context", 42) {
        StringBuilder().block(true)
    }
}

When I tried:

function.parameters.forEach {
    println("function parameter: $it")
    println("function parameter.type.annotations.resolve().annotations: ${it.type.resolve().annotations.toList()}")
}

I got:

function parameter: block
function parameter.type.annotations.resolve().annotations: [@ExtensionFunctionType]

I haven't found an API to directly access the context parameters, nor can I indirectly parse it using the kotlin.ContextFunctionTypeParams annotation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1major features or blocking bugsapiAPI changes may be involved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions