Skip to content

Incorrect coverage detection (branching) for chains with non-nullable properties a?.b?.c? #745

@vkatz

Description

@vkatz

Describe the bug
Incorrect coverage detection (branching) for chains

class B{
     val c =1
}
class A{
    val b = B()
}
val a : A? ...
val c1 = a?.b?.c?: -1 // <- detected as yellow (not all branches covered)
val c2 = a?.let{ it.b.c } ?: -1 // fine

assume it thinks

a?.b?.c?

==

if(a!=null){
     if(a.b!=null){ //always true
          if(a.b.c !=null) a.b.c // always true
          else null // not covered, unreachable
     } else null // not covered, unreachable
} else null

Image

Image

destination & name is not-nullable properties

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug issue typeS: untriagedStatus: issue reported but unprocessed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions