1
0
forked from VimPlug/jedi

Make Union/Optional works with compiled objects

This commit is contained in:
Dave Halter
2020-01-10 13:34:10 +01:00
parent ba7776c0d9
commit cac73f2d44
3 changed files with 23 additions and 1 deletions

View File

@@ -271,6 +271,11 @@ class CompiledObject(Value):
if self.access_handle.get_repr() == 'None':
# None as an annotation doesn't need to be executed.
return ValueSet([self])
name, args = self.access_handle.get_annotation_name_and_args()
arguments = [create_from_access_path(self.inference_state, path) for path in args]
if name == 'typing.Union':
return ValueSet.from_sets(arg.execute_annotation() for arg in arguments)
return super(CompiledObject, self).execute_annotation()
def negate(self):