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

Arrow is not always redundant when parameter list is empty #2928

Open
okamt opened this issue Jan 19, 2025 · 0 comments
Open

Arrow is not always redundant when parameter list is empty #2928

okamt opened this issue Jan 19, 2025 · 0 comments

Comments

@okamt
Copy link

okamt commented Jan 19, 2025

Currently ktlint removes the arrow in a zero parameter lambda by default. I'm working with Java code that has a lot of method overloads like:

static fun <T : Any!> builder(defaultValueSupplier: Supplier<T!>!): Something.Builder<T!>!
static fun <T : Any!> builder(defaultValueConstructor: Function<OtherThing!, T!>!): Something.Builder<T!>!

Calling it with builder { someValue } creates an ambuguity since the lambda could have either zero or one parameters. Disambuiguating with builder { -> someValue } is necessary here, but results in a Arrow is redundant when parameter list is empty (standard:function-literal) violation

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

1 participant