From 20d914f8493976103780ec03e52f0833bd258b6c Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Mon, 12 Jun 2017 12:29:06 +1000 Subject: [PATCH] An "if" with no "else" does not terminate. --- lang/check/bounds.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lang/check/bounds.go b/lang/check/bounds.go index 69f24d4c..58a9d476 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -355,12 +355,13 @@ func terminates(body []*a.Node) bool { if !terminates(n.BodyIfTrue()) { return false } - if bif := n.BodyIfFalse(); len(bif) > 0 && !terminates(bif) { + bif := n.BodyIfFalse() + if len(bif) > 0 && !terminates(bif) { return false } n = n.ElseIf() if n == nil { - return true + return len(bif) > 0 } } }