diff --git a/jedi/inference/compiled/mixed.py b/jedi/inference/compiled/mixed.py index 7d76113a..ce31d7e0 100644 --- a/jedi/inference/compiled/mixed.py +++ b/jedi/inference/compiled/mixed.py @@ -84,6 +84,9 @@ class MixedObject(ValueWrapper): return self.compiled_value.py__simple_getitem__(index) return self._wrapped_value.py__simple_getitem__(index) + def negate(self): + return self.compiled_value.negate() + def _as_context(self): if self.parent_context is None: return MixedModuleContext(self) diff --git a/test/test_api/test_interpreter.py b/test/test_api/test_interpreter.py index ee7617ca..0155d49f 100644 --- a/test/test_api/test_interpreter.py +++ b/test/test_api/test_interpreter.py @@ -704,3 +704,11 @@ def test_variable_reuse(): x = 1 d, = jedi.Interpreter('y = x\ny', [locals()]).infer() assert d.name == 'int' + + +def test_negate(): + code = "x = -y" + x, = jedi.Interpreter(code, [{'y': 3}]).infer(1, 0) + assert x.name == 'int' + value, = x._name.infer() + assert value.get_safe_value() == -3