1
0
forked from VimPlug/jedi

Fix ClassVars and add tests

This commit is contained in:
Dave Halter
2018-08-30 01:52:05 +02:00
parent 7fc311bb3e
commit c0c6ce2987
2 changed files with 16 additions and 1 deletions

View File

@@ -166,7 +166,7 @@ class TypingContextWithIndex(_WithIndexBase):
return ContextSet(self._index_context) return ContextSet(self._index_context)
elif string_name == 'ClassVar': elif string_name == 'ClassVar':
# For now don't do anything here, ClassVars are always used. # For now don't do anything here, ClassVars are always used.
return self._context.execute_annotation() return self._index_context.execute_annotation()
cls = globals()[string_name] cls = globals()[string_name]
return ContextSet(cls(self._name, self._index_context, self._context_of_index)) return ContextSet(cls(self._name, self._index_context, self._context_of_index))

View File

@@ -36,3 +36,18 @@ char: str
for char in NOT_DEFINED: for char in NOT_DEFINED:
#? str() #? str()
char char
class Foo():
bar: int
baz: typing.ClassVar[str]
#? int()
Foo.bar
#? int()
Foo().bar
#? str()
Foo.baz
#? str()
Foo().baz