From: Robert Bradshaw Date: Sat, 8 Jan 2011 07:53:37 +0000 (-0800) Subject: Fix indexing type inference. X-Git-Tag: 0.14.1rc0~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=43a3dbea06e00bf6eb6592017964b79e35bae2d6;p=cython.git Fix indexing type inference. --- 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]