From e5205680cf9e2b8666cec3581a36914a1beb4b98 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Sat, 18 Apr 2015 15:46:31 -0500
Subject: [PATCH] Don't implicitly expand subst rules as part of type inference

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

diff --git a/loopy/preprocess.py b/loopy/preprocess.py
index 64736a40a..d614dc164 100644
--- a/loopy/preprocess.py
+++ b/loopy/preprocess.py
@@ -26,7 +26,7 @@ THE SOFTWARE.
 import six
 import numpy as np
 from loopy.diagnostic import (
-        LoopyError, LoopyWarning, WriteRaceConditionWarning, warn,
+        LoopyError, WriteRaceConditionWarning, warn,
         LoopyAdvisory)
 
 from pytools.persistent_dict import PersistentDict
@@ -139,12 +139,8 @@ def infer_unknown_types(kernel, expect_completion=False):
     def debug(s):
         logger.debug("%s: %s" % (kernel.name, s))
 
+    unexpanded_kernel = kernel
     if kernel.substitutions:
-        from warnings import warn as py_warn
-        py_warn("type inference called when substitution "
-                "rules are still unexpanded, expanding",
-                LoopyWarning, stacklevel=2)
-
         from loopy.subst import expand_subst
         kernel = expand_subst(kernel)
 
@@ -240,7 +236,7 @@ def infer_unknown_types(kernel, expect_completion=False):
 
     # }}}
 
-    return kernel.copy(
+    return unexpanded_kernel.copy(
             temporary_variables=new_temp_vars,
             args=[new_arg_dict[arg.name] for arg in kernel.args],
             )
-- 
GitLab