Files
Andrey Vlasovskikh f73ae3f9bf Fixed unresolved reference for parameters which methods are invoked inside the function body (PY-11541)
We may get stuck in a recursive resolve loop (that results in unresolved
references) if we match arguments to parameters for a call where the
callee is a reference to the named parameter itself.

The loop used to go like this:

1. Get the type of 'foo.bar' in 'foo.bar(foo)'
2. Get the type of 'foo' in 'def f(foo)'
3. Find the structural type for 'foo'
4. Ask nested calls where 'foo' is a parameter
5. Try to match args to params in 'foo.bar(foo)'
6. Resolve 'foo.bar'
7. Get the type of 'foo.bar' in 'foo.bar(foo')
8. Since the 'foo.bar' is evaluating, it's 'null' for preventing
   recursion
9. So 'foo.bar' resolves to 'null' which is false
2015-05-22 13:07:48 +02:00

5 lines
113 B
Python

def repl(s):
if not isinstance(s, basestring):
return s
return s.replace(s.replace('a', 'b'), s)