1.1 --- a/deducer.py Sat Mar 04 00:20:25 2017 +0100
1.2 +++ b/deducer.py Sat Mar 04 23:48:19 2017 +0100
1.3 @@ -35,6 +35,8 @@
1.4
1.5 "Deduce types in a program."
1.6
1.7 + root_class_type = "__builtins__.object"
1.8 +
1.9 def __init__(self, importer, output):
1.10
1.11 """
1.12 @@ -612,6 +614,7 @@
1.13 all_accessed_attrs.add(attr)
1.14 all_providers.add(object_type)
1.15
1.16 + self.reference_all_attrs[location] = all_accessed_attrs
1.17 all_general_providers = self.get_most_general_types(all_providers)
1.18
1.19 # Determine which attributes would be provided by the
1.20 @@ -627,8 +630,6 @@
1.21 else:
1.22 guard_attrs = None
1.23
1.24 - self.reference_all_attrs[location] = all_accessed_attrs
1.25 -
1.26 # Constrained accesses guarantee the nature of the accessor.
1.27 # However, there may still be many types involved.
1.28
1.29 @@ -664,7 +665,7 @@
1.30
1.31 elif len(all_providers) == 1:
1.32 provider = first(all_providers)
1.33 - if provider != '__builtins__.object':
1.34 + if provider != self.root_class_type:
1.35 all_accessor_kinds = set(get_kinds(all_accessor_types))
1.36 if len(all_accessor_kinds) == 1:
1.37 test_type = ("test", "specific", test_label_for_kind(first(all_accessor_kinds)))
1.38 @@ -675,7 +676,7 @@
1.39
1.40 elif len(all_general_providers) == 1:
1.41 provider = first(all_general_providers)
1.42 - if provider != '__builtins__.object':
1.43 + if provider != self.root_class_type:
1.44 all_accessor_kinds = set(get_kinds(all_accessor_general_types))
1.45 if len(all_accessor_kinds) == 1:
1.46 test_type = ("test", "common", test_label_for_kind(first(all_accessor_kinds)))
1.47 @@ -1096,7 +1097,7 @@
1.48 # attributes.
1.49
1.50 if len(module_types) == len(self.importer.modules):
1.51 - return ["__builtins__.object"]
1.52 + return [self.root_class_type]
1.53 else:
1.54 return module_types
1.55