From 6ca3eff831ac83304fe275a0e9cdad4bbe496989 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Fri, 7 Jun 2013 11:21:50 -0400
Subject: [PATCH] Fix termination of type inference if expect_completion is
 False.

---
 loopy/preprocess.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/loopy/preprocess.py b/loopy/preprocess.py
index d088e1216..56579920c 100644
--- a/loopy/preprocess.py
+++ b/loopy/preprocess.py
@@ -144,9 +144,14 @@ def infer_unknown_types(kernel, expect_completion=False):
             logger.debug("     failure")
 
         if failed:
-            if expect_completion and item.name in failed_names:
+            if item.name in failed_names:
                 # this item has failed before, give up.
-                raise RuntimeError("could not determine type of '%s'" % item.name)
+                if expect_completion:
+                    raise RuntimeError(
+                            "could not determine type of '%s'" % item.name)
+                else:
+                    # We're done here.
+                    break
 
             # remember that this item failed
             failed_names.add(item.name)
-- 
GitLab