Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4880cc

Browse files
committed
Kotlin: Fix handling of non-true conditions
1 parent b9d6712 commit c4880cc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

java/ql/lib/semmle/code/java/ControlFlowGraph.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,9 +930,12 @@ private module ControlFlowGraphImpl {
930930
or
931931
exists(WhenBranch whenbranch | whenbranch = n |
932932
// If the condition completes with anything other than true
933-
// (e.g. false or an exception), then the branch is done
933+
// (or "normal", which we will also see if we don't know how
934+
// to make specific true/false edges for the condition)
935+
// (e.g. false or an exception), then the branch is done.
934936
last(whenbranch.getCondition(), last, completion) and
935-
completion != BooleanCompletion(true, _)
937+
not completion = BooleanCompletion(true, _) and
938+
not completion = NormalCompletion()
936939
or
937940
// Otherwise we wrap the completion up in a YieldCompletion
938941
// so that the `when` expression can tell that we have finished,

0 commit comments

Comments
 (0)