# HG changeset patch # User Paul Boddie # Date 1489705008 -3600 # Node ID 76beb2df647dc7fb098d83ea0e6bd444ab102e3c # Parent 56d2e278e68b4e83ae8a5150fd3e47c814fa73bf Obtain all references produced for return values, potentially allowing a gradual narrowing of accessor types. diff -r 56d2e278e68b -r 76beb2df647d deducer.py --- a/deducer.py Thu Mar 16 23:26:37 2017 +0100 +++ b/deducer.py Thu Mar 16 23:56:48 2017 +0100 @@ -1879,10 +1879,10 @@ providers = set() for ref in refs: - ref = self.convert_invocation_provider(ref) - if ref.has_kind(""): - providers.add(Reference("", ref.get_origin())) - providers.add(ref) + for invocation_ref in self.convert_invocation_provider(ref): + if invocation_ref.has_kind(""): + providers.add(Reference("", invocation_ref.get_origin())) + providers.add(invocation_ref) return providers @@ -1905,7 +1905,15 @@ value. """ - return invocation and map(self.convert_invocation, refs) or refs + if not invocation: + return refs + + invocation_refs = set() + + for ref in refs: + invocation_refs.update(self.convert_invocation(ref)) + + return invocation_refs def convert_invocation(self, ref): @@ -1913,11 +1921,11 @@ if ref: if ref.has_kind(""): - return ref.instance_of() + return [ref.instance_of()] elif ref.has_kind(""): return self.convert_function_invocation(ref) - return Reference("") + return [Reference("")] def convert_function_invocation(self, ref): @@ -1925,11 +1933,9 @@ initialised_names = self.importer.all_initialised_names.get((ref.get_origin(), "$return")) if initialised_names: - refs = set(initialised_names.values()) - if len(refs) == 1: - return first(refs) - - return Reference("") + return set(initialised_names.values()) + + return [Reference("")] def get_initialised_name(self, access_location):