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

EMPTY_BLOCK_STRUCTURE_ERROR shouldn't trigger on empty lambdas #796

Closed
petertrr opened this issue Mar 11, 2021 · 0 comments · Fixed by #803
Closed

EMPTY_BLOCK_STRUCTURE_ERROR shouldn't trigger on empty lambdas #796

petertrr opened this issue Mar 11, 2021 · 0 comments · Fixed by #803
Assignees
Labels
bug Something isn't working

Comments

@petertrr
Copy link
Member

Describe the bug

Sometimes empty lambda can be used as a function that does nothing:

fun foo(bar: () -> Unit = {})

or empty function in implementation of functional interface:

A({})  // instead of A(Disposable {}), where Disposable is functional interface from Java

Diktat shouldn't issue a warning in these cases, because they are valid and can't be done differentlty. Also, kotlin copiler warns that Unit is redundant in { Unit }.

Environment information

  • diktat version: 0.4.2
@petertrr petertrr added the bug Something isn't working label Mar 11, 2021
@aktsay6 aktsay6 self-assigned this Mar 19, 2021
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
aktsay6 added a commit that referenced this issue Mar 19, 2021
### What's done:
  * Fixed bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants