-
-
Notifications
You must be signed in to change notification settings - Fork 821
Fix #2021 #2032
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
Fix #2021 #2032
Conversation
| val returnExpressionsInBlock = bodyExpression.collectDescendantsOfType<KtReturnExpression> { | ||
| it.parent == bodyExpression || it.parent is KtAnnotatedExpression && it.parent.parent == bodyExpression | ||
| } | ||
| val lastValidReturnExpression = returnExpressionsInBlock.first().returnedExpression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm is the bodyExpression the Annotation itself?
That could explain why getChildrenOfType is empty and first crashes.
We should also use firstOrNull, don't we?
I'm not sure what happens here, but will try to debug it too.
Codecov Report
@@ Coverage Diff @@
## master #2032 +/- ##
=========================================
Coverage ? 80.35%
Complexity ? 2015
=========================================
Files ? 332
Lines ? 5661
Branches ? 1044
=========================================
Hits ? 4549
Misses ? 559
Partials ? 553
Continue to review full report at Codecov.
|
* Fix detekt#2021 * minor refactor * fix typo
* Fix detekt#2021 * minor refactor * fix typo
Fixes #2021
This feels slightly hacky but I can't think of any better way at the moment :/