From 3802355a62833a4ab417c50b2eb5da9c1b4906e3 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Thu, 28 Nov 2013 01:43:40 -0600
Subject: [PATCH] Don't add empty advice to type determination error message

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

diff --git a/loopy/preprocess.py b/loopy/preprocess.py
index 8d9f4093a..ed8e24c43 100644
--- a/loopy/preprocess.py
+++ b/loopy/preprocess.py
@@ -174,11 +174,17 @@ def infer_unknown_types(kernel, expect_completion=False):
         if failed:
             if item.name in failed_names:
                 # this item has failed before, give up.
+                advice = ""
+                if symbols_with_unavailable_types:
+                    advice += (
+                            " (need type of '%s'--check for missing arguments)"
+                            % ", ".join(symbols_with_unavailable_types))
+
                 if expect_completion:
                     raise LoopyError(
-                            "could not determine type of '%s' "
-                            "(need type of '%s'--check for missing arguments)"
-                            % (item.name, ", ".join(symbols_with_unavailable_types)))
+                            "could not determine type of '%s'%s"
+                            % (item.name, advice))
+
                 else:
                     # We're done here.
                     break
-- 
GitLab