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

operator get with lambda: incorrect error #2675

Closed
Jolanrensen opened this issue May 28, 2024 · 0 comments · Fixed by #2677
Closed

operator get with lambda: incorrect error #2675

Jolanrensen opened this issue May 28, 2024 · 0 comments · Fixed by #2677
Milestone

Comments

@Jolanrensen
Copy link
Contributor

Expected Behavior

Given:

class DB {
    operator fun <T> get(query: DB.() -> T): T = TODO()
}

val db = DB()
val query = db[{ 123 }]

so, an operator get function with a lambda argument inside, KtLint should be happy with this notation. It is accepted by IntelliJ.

Observed Behavior

We get a linting error:
Lint error > [standard:curly-spacing] Missing spacing before "{".

If I run the formatter instead it performs a fix and reverts it again:
Format fixed > [standard:curly-spacing] Missing spacing before "{"

Format fixed > [standard:square-brackets-spacing] Unexpected spacing after '['

Steps to Reproduce

See the example above.

Your Environment

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

Successfully merging a pull request may close this issue.

2 participants