Files
openide/python/testData/completion/incompleteQualifiedNameClashesWithLocalVariable.py
Mikhail Golubev f8d31ac2b0 PY-21175 More predictable behavior of PyQualifiedExpression#asQualifiedName()
Namely, expressions like "foo().bar" don't return "bar" as their
qualified name leading to mixing them up with references to local
variables in CFG.

Moreover, qualified expressions like "foo[0].bar" or "foo[0][1]"
are not mapped to confusing qualified names "foo.__getitem__.bar" and
"foo.__getitem__.__getitem__" respectively anymore. These "magic"
names are preserved only as the trailing (rightmost) component of
the result, and in all other cases asQualifiedName() returns null.

It also allows us to use asQualifiedName() to check that the given
reference expression is well-formed and contains only plain names
as qualifiers, that, in particular, was necessary in TypingTypeProvider
and PyTypingAliasStubType and assumed as possible in other places
(but actually broken).
2017-07-24 14:38:41 +03:00

8 lines
93 B
Python

class MyClass:
foo = 'spam'
def f(foo):
foo.illegal = 42
MyClass().foo.<caret>