checker: comp. if branch logic fix (#6473)

pull/6478/head
spaceface777 2020-09-25 11:48:27 +02:00 committed by GitHub
parent 90d1a689db
commit 0b95d72354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -3423,12 +3423,12 @@ fn (mut c Checker) comp_if_branch(cond ast.Expr, pos token.Position) bool {
.and {
l := c.comp_if_branch(cond.left, cond.pos)
r := c.comp_if_branch(cond.right, cond.pos)
return l && r
return l || r // skip (return true) if at least one should be skipped
}
.logical_or {
l := c.comp_if_branch(cond.left, cond.pos)
r := c.comp_if_branch(cond.right, cond.pos)
return l || r
return l && r // skip (return true) only if both should be skipped
}
.key_is, .not_is {
// $if method.@type is string