Commit 48adadf1 authored by Stefan Behnel's avatar Stefan Behnel

use inferred NameNode type for builtin types instead of more generic entry type

parent dab03a3c
...@@ -1755,6 +1755,10 @@ class NameNode(AtomicExprNode): ...@@ -1755,6 +1755,10 @@ class NameNode(AtomicExprNode):
self.check_identifier_kind() self.check_identifier_kind()
entry = self.entry entry = self.entry
type = entry.type type = entry.type
if (type.is_pyobject and self.inferred_type and
self.inferred_type.is_builtin_type):
# assume that type inference is smarter than the static entry
type = self.inferred_type
self.type = type self.type = type
def check_identifier_kind(self): def check_identifier_kind(self):
......
...@@ -252,6 +252,23 @@ def iter_and_in(): ...@@ -252,6 +252,23 @@ def iter_and_in():
if c in u'abCDefGh': if c in u'abCDefGh':
print c print c
#@cython.test_fail_if_path_exists('//ForInStatNode')
def iter_inferred():
"""
>>> iter_inferred()
a
b
c
d
e
"""
uchars = list(u"abcde")
uchars = u''.join(uchars)
for c in uchars:
print c
@cython.test_assert_path_exists('//SwitchStatNode', @cython.test_assert_path_exists('//SwitchStatNode',
'//ForFromStatNode') '//ForFromStatNode')
@cython.test_fail_if_path_exists('//ForInStatNode') @cython.test_fail_if_path_exists('//ForInStatNode')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment