From e746e12a3df0e39983ba76d2685a642c650bbc01 Mon Sep 17 00:00:00 2001
From: arghdos <arghdos@gmail.com>
Date: Fri, 2 Dec 2016 10:03:07 -0500
Subject: [PATCH] fix inner / outer scope test

---
 loopy/kernel/creation.py | 1 +
 test/test_loopy.py       | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py
index 5427d96ca..cdede223d 100644
--- a/loopy/kernel/creation.py
+++ b/loopy/kernel/creation.py
@@ -825,6 +825,7 @@ def parse_instructions(instructions, defines):
             else:
                 assert else_match is not None
                 if not last_if_predicates:
+                    import pdb; pdb.set_trace()
                     raise LoopyError("'else' without 'if'/'elif' encountered")
                 additional_preds = frozenset()
 
diff --git a/test/test_loopy.py b/test/test_loopy.py
index debfd8051..4221feb79 100644
--- a/test/test_loopy.py
+++ b/test/test_loopy.py
@@ -1811,6 +1811,8 @@ def test_if_else(ctx_factory):
                     else
                         a[i] = 3
                     end
+                else
+                    a[i] = 4
                 end
             end
             """
@@ -1818,8 +1820,9 @@ def test_if_else(ctx_factory):
 
     evt, (out,) = knl(queue, out_host=True)
 
-    out_ref = np.empty(50)
-    out_ref[::6] = 15
+    out_ref = np.zeros(50)
+    out_ref[1::2] = 4
+    out_ref[0::6] = 15
     out_ref[4::6] = 11
     out_ref[2::6] = 3
 
-- 
GitLab