From 9f5f156b9d911b6c6282eb4cf0e4f8a9129169c5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 8 Oct 2015 13:08:59 +0100 Subject: py/emitnative: Raise ViperTypeError for unsupported unary ops. --- tests/micropython/viper_error.py | 5 +++++ tests/micropython/viper_error.py.exp | 3 +++ 2 files changed, 8 insertions(+) (limited to 'tests/micropython') diff --git a/tests/micropython/viper_error.py b/tests/micropython/viper_error.py index 0762f5079..116bd4ea0 100644 --- a/tests/micropython/viper_error.py +++ b/tests/micropython/viper_error.py @@ -52,3 +52,8 @@ test("@micropython.viper\ndef f(): 1[x] = 1") # must raise an object test("@micropython.viper\ndef f(): raise 1") + +# unary ops not implemented +test("@micropython.viper\ndef f(x:int): +x") +test("@micropython.viper\ndef f(x:int): -x") +test("@micropython.viper\ndef f(x:int): ~x") diff --git a/tests/micropython/viper_error.py.exp b/tests/micropython/viper_error.py.exp index ad1ba34c6..1afcd4bdb 100644 --- a/tests/micropython/viper_error.py.exp +++ b/tests/micropython/viper_error.py.exp @@ -10,3 +10,6 @@ ViperTypeError("can't load from 'int'",) ViperTypeError("can't store to 'int'",) ViperTypeError("can't store to 'int'",) ViperTypeError('must raise an object',) +ViperTypeError('unary op __pos__ not implemented',) +ViperTypeError('unary op __neg__ not implemented',) +ViperTypeError('unary op __invert__ not implemented',) -- cgit v1.2.3