Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function Literal formatting seems off #2818

Closed
ZakTaccardi opened this issue Oct 1, 2024 · 1 comment
Closed

Function Literal formatting seems off #2818

ZakTaccardi opened this issue Oct 1, 2024 · 1 comment

Comments

@ZakTaccardi
Copy link

function-literal (docs) formatting seems off.

When calling into this function:

@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING")

package com.capitalone.android.identity.challenge.internal.logic

fun <T1, T2, R> combine(
    result1: Result<T1>,
    result2: Result<T2>,
    transform: suspend (T1, T2) -> R
) {
    TODO()
}

Expected Behavior

I would expect something like this:

fun usageExpected(result1: Result<Int>, result2: Result<String>) {
    combine(
        result1 = result1,
        result2 = result2
    ) { one: Int,
        two: String ->
        "$one$two"
    }
}

Observed Behavior

But instead, we get this:

fun usageActual(result1: Result<Int>, result2: Result<String>) {
    combine(
        result1 = result1,
        result2 = result2
    ) {
            one: Int,
            two: String
        ->
        "$one$two"
    }
}

The parameters (one: Int and two: String) being indented an extra 4 spaces seems very off to me.

Your Environment

  • Version of ktlint used: 1.3.1
@paul-dingemans
Copy link
Collaborator

Duplicate of #2816

@paul-dingemans paul-dingemans marked this as a duplicate of #2816 Oct 2, 2024
@paul-dingemans paul-dingemans closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants