Commit b08fc9c7 authored by Stefan Behnel's avatar Stefan Behnel

add safety check for cross-closure type inference

parent e440f779
......@@ -401,7 +401,13 @@ class SimpleAssignmentTypeInferer(object):
entry_type = py_object_type
# propagate entry type to all nested scopes
for e in entry.all_entries():
if e.type is unspecified_type:
e.type = entry_type
else:
# FIXME: can this actually happen?
assert e.type == entry_type, (
'unexpected type mismatch between closures for inferred type %s: %s vs. %s' %
entry_type, e, entry)
if verbose:
message(entry.pos, "inferred '%s' to be of type '%s'" % (entry.name, entry.type))
resolve_dependancy(entry)
......
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