Fix indexing type inference.
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 8 Jan 2011 07:53:37 +0000 (23:53 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 8 Jan 2011 07:53:37 +0000 (23:53 -0800)
Cython/Compiler/ExprNodes.py
tests/run/type_inference.pyx

index 39b936302d25409a168650fb899d4ef6c39acac5..8332f443a552e0d168fb6223c4400ec3b5162a60 100755 (executable)
@@ -2033,7 +2033,7 @@ class IndexNode(ExprNode):
         return None
 
     def type_dependencies(self, env):
-        return self.base.type_dependencies(env)
+        return self.base.type_dependencies(env) + self.index.type_dependencies(env)
 
     def infer_type(self, env):
         base_type = self.base.infer_type(env)
index b411d5b59605b5dcd4ff42143ee9b20e8393d4c0..dc4566104c11882b733c48ced373d4c26797ae71 100644 (file)
@@ -479,3 +479,10 @@ def large_literals():
     c, d = 10, 100000000000000000000000000000000
     assert typeof(c) == "long", typeof(c)
     assert typeof(d) == "Python object", typeof(d)
+
+
+# Regression test for trac #638.
+
+def bar(foo):
+    qux = foo
+    quux = foo[qux.baz]