[OptionalUnit] Allow a function to declare a Unit return type when it uses a generic function initializer - #4371
Conversation
… function initializer
| import io.gitlab.arturbosch.detekt.api.Severity | ||
| import io.gitlab.arturbosch.detekt.rules.isOverride | ||
| import org.jetbrains.kotlin.cfg.WhenChecker | ||
| import org.jetbrains.kotlin.js.translate.callTranslator.getReturnType |
There was a problem hiding this comment.
No idea why this is in a JavaScript package, but it appears to work in JVM code.
Codecov Report
@@ Coverage Diff @@
## main #4371 +/- ##
============================================
+ Coverage 84.26% 84.29% +0.02%
- Complexity 3263 3275 +12
============================================
Files 473 473
Lines 10336 10340 +4
Branches 1827 1830 +3
============================================
+ Hits 8710 8716 +6
Misses 667 667
+ Partials 959 957 -2
Continue to review full report at Codecov.
|
…ing are provided; Slight optimization in OptionalUnit for determining whether a function has an explicit return type
|
@BraisGabin I'm not sure what I'm supposed to do here. CodeCov is requiring that I write a test where one of the two lines below returns a null value: Otherwise, the PR is not hitting the target rate of 80% code coverage. The problem is that writing that test would require creating a code snippet where, for example, the function initializer isn't recognized (e.g. |
Don't care about that. If the tests really cover the main logic it's enough. If you check you are under the target but even with that you are increasing the coverage. |
This addresses issue #4363.