# HG changeset patch # User paulb@localhost.localdomain # Date 1182814206 -7200 # Node ID 7c2342653b6cf78b1be34f276c4f67aadb53b8a2 # Parent 1d181dc3a6a35aaa1b34ed18387051dfcfef27d0 Make subprogram replacement dependent on the signature, not just the owner instance. diff -r 1d181dc3a6a3 -r 7c2342653b6c simplify/fixinstances.py --- a/simplify/fixinstances.py Mon Jun 25 00:32:56 2007 +0200 +++ b/simplify/fixinstances.py Tue Jun 26 01:30:06 2007 +0200 @@ -208,16 +208,21 @@ return distinct_instances[value] # For subprograms, find the distinct instance's copy for the owner - # instance; otherwise, return the original subprogram. + # instance and assert that the signatures are the same; otherwise, + # return the original subprogram. + # NOTE: This needs to be verified in a somewhat more formal fashion. elif isinstance(value, Subprogram): if hasattr(value, "copy_of") and hasattr(value, "instance"): cls = value.instance.get_class() distinct = cls.get_distinct_instances() instance = distinct[value.instance] - return value.copy_of.copies.get(instance, value) - else: - return value + if value.copy_of.copies.has_key(instance): + subprogram = value.copy_of.copies[instance] + if subprogram.paramtypes == value.paramtypes: + return subprogram + + return value # Return all other values as they are.