mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-28 04:37:32 +07:00
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
5 lines
113 B
Python
5 lines
113 B
Python
def repl(s):
|
|
if not isinstance(s, basestring):
|
|
return s
|
|
return s.replace(s.replace('a', 'b'), s)
|