Merge pull request #95 from github/hvitved/cfg/not-bug

CFG: Fix bug in `LogicalNotTree`
This commit is contained in:
Tom Hvitved
2021-01-18 16:05:39 +01:00
committed by GitHub
3 changed files with 32 additions and 7 deletions

View File

@@ -782,12 +782,8 @@ module Trees {
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
succ = this and
(
last(operand, pred, c.(BooleanCompletion).getDual())
or
last(operand, pred, c) and
c instanceof SimpleCompletion
)
last(operand, pred, c) and
c instanceof NormalCompletion
}
}

View File

@@ -103,6 +103,9 @@ ifs.rb:
# 36| enter conditional_method_def
#-----| -> puts
# 40| enter constant_condition
#-----| -> true
loops.rb:
# 1| enter top-level
#-----| -> m1
@@ -2440,7 +2443,7 @@ ifs.rb:
#-----| -> If
# 36| UnlessModifier
#-----| -> exit top-level (normal)
#-----| -> constant_condition
# 36| Method
#-----| -> UnlessModifier
@@ -2467,6 +2470,21 @@ ifs.rb:
# 38| 2
#-----| -> Binary
# 40| Method
#-----| -> exit top-level (normal)
# 40| constant_condition
#-----| -> Method
# 41| If
#-----| -> exit constant_condition (normal)
# 41| [false] Unary
#-----| false -> If
# 41| true
#-----| true -> [false] Unary
loops.rb:
# 1| Method
#-----| -> m2
@@ -3771,6 +3789,8 @@ ifs.rb:
# 36| exit conditional_method_def
# 40| exit constant_condition
loops.rb:
# 1| exit top-level
@@ -3926,6 +3946,9 @@ ifs.rb:
# 36| exit conditional_method_def (normal)
#-----| -> exit conditional_method_def
# 40| exit constant_condition (normal)
#-----| -> exit constant_condition
loops.rb:
# 1| exit top-level (normal)
#-----| -> exit top-level

View File

@@ -36,3 +36,9 @@ end
def conditional_method_def()
puts "bla"
end unless 1 == 2
def constant_condition()
if !true
puts "Impossible"
end
end