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

Inline function with functional parameter covered partially #629

Open
shanshin opened this issue Jun 10, 2024 · 1 comment
Open

Inline function with functional parameter covered partially #629

shanshin opened this issue Jun 10, 2024 · 1 comment
Assignees
Labels
Bug Bug issue type S: confirmed Status: bug is reproduced or present

Comments

@shanshin
Copy link
Collaborator

Errors
Some line covered partially

Expected behavior
All lines should be fully covered (green)

Reproducer
Source class

inline fun myInline(producer: () -> Int?) {
    val value = producer()?.inc()
    println(value)
}

Test

    @Test
    fun test() {
        myInline { 41 }
        myInline { null }
    }

Reports
Screenshot 2024-06-10 at 17 17 41

Environment

  • IntelliJ agent 1.0.754
@shanshin shanshin added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Jun 10, 2024
@shanshin shanshin self-assigned this Jun 10, 2024
@shanshin shanshin added S: confirmed Status: bug is reproduced or present and removed S: untriaged Status: issue reported but unprocessed labels Jun 10, 2024
@JavierSegoviaCordoba
Copy link

Same for

public inline fun CharSequence?.isNotNullNorBlank(): Boolean {
    contract { returns(true) implies (this@isNotNullNorBlank != null) }
    return !isNullOrBlank()
}

public inline fun CharSequence?.isNotNullNorEmpty(): Boolean {
    contract { returns(true) implies (this@isNotNullNorEmpty != null) }
    return !isNullOrEmpty()
}

image

If I remove inline, they are covered.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: confirmed Status: bug is reproduced or present
Projects
None yet
Development

No branches or pull requests

2 participants