From 43a3dbea06e00bf6eb6592017964b79e35bae2d6 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 7 Jan 2011 23:53:37 -0800 Subject: [PATCH] Fix indexing type inference. --- Cython/Compiler/ExprNodes.py | 2 +- tests/run/type_inference.pyx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 39b93630..8332f443 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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) diff --git a/tests/run/type_inference.pyx b/tests/run/type_inference.pyx index b411d5b5..dc456610 100644 --- a/tests/run/type_inference.pyx +++ b/tests/run/type_inference.pyx @@ -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] -- 2.26.2