kotlinx-kover
kotlinx-kover copied to clipboard
Inline only function
In our project we use @kotlin.internal.InlineOnly functions like sortedBy but kover can't cover this lines. How can we do it?
We have the same problem. I think this is a bug.
Hi,
could you clarify the coverage of which functions you would like to measure? Are these custom functions marked as InlineOnly?
We have this problem in sortedBy function even it was testing. It reproduce on Kotlin v. 1.7.10
@clickjamper Could you please share a screenshot of an HTML report, where we can see what lines are uncovered? Also, a call point of the method would be helpful
I made a minimal reproducible example here with Kotlin 1.9.24 and kover 0.8.0. I hope this is the same problem the issue creator and other reporters experienced.
One thing to note in advance: if the Iterable to be sorted with sortedBy only contains <= 1 elements Kotlin will not call the selector function passed to sortedBy. sortedBy calls sortedWith and sortedWith contains this logic here
Whether or not the selector is called, the table above the code shows 0% method coverage specifically for the inline functions.
Depends on the Compiler task https://youtrack.jetbrains.com/issue/KT-68006/Full-debug-information-for-call-of-InlineOnly
I have the same problem using Iterable.maxOf() from _Collections.kt wich is also declared inline and marked @kotlin.internal.InlineOnly - Kover reports only some of the 6 branches are covered and I have no branches in my code