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
Optional function parameters should not be considered a "branch" #303
Comments
Due to the nature of the source code, I'm not sure I can share a whole test report, but I can try to explain it a bit more clearly. We are using R2DBC to read data from database tables. This means we are calling a Repository and when we try to retrieve multiple records, we use the This is leading to a "branch" missing coverage on that After running into this issue in a few other places, we believe the issue has to do with optional parameters not being passed into the function |
(for reference) This is the
|
Default arguments can only affect coverage of the definition of a function. |
Fixed in |
What is your use-case and why do you need this feature?
Function:
fun foo(bar: Boolean = false) = if (bar) "bar" else "foobar"
Invocation:
foo()
is missing coverage since it's utilizing the default parameterThis is especially important when the function that has optional parameters is not one that we wrote or have control over
i.e.
kotlinx.coroutines.flow.toList
is giving us this issue todayDescribe the solution you'd like
Optional parameters should not be considered a branching condition, otherwise we can't leverage them without missing coverage.
(A setting to toggle this feature would also be sufficient if there are projects that like the current behavior)
The text was updated successfully, but these errors were encountered: