summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--py/emitnative.c7
-rw-r--r--tests/micropython/viper_args.py10
-rw-r--r--tests/micropython/viper_args.py.exp2
-rw-r--r--tests/micropython/viper_error.py3
-rw-r--r--tests/micropython/viper_error.py.exp1
5 files changed, 11 insertions, 12 deletions
diff --git a/py/emitnative.c b/py/emitnative.c
index b26beb407..4188b4256 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -295,13 +295,6 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
// generate code for entry to function
if (emit->do_viper_types) {
-
- // right now we have a restriction of maximum of 4 arguments
- if (scope->num_pos_args > REG_ARG_NUM) {
- EMIT_NATIVE_VIPER_TYPE_ERROR(emit, "Viper functions don't currently support more than 4 arguments");
- return;
- }
-
// Work out size of state (locals plus stack)
// n_state counts all stack and locals, even those in registers
emit->n_state = scope->num_locals + scope->stack_size;
diff --git a/tests/micropython/viper_args.py b/tests/micropython/viper_args.py
index 2aebe1b04..ee8e82321 100644
--- a/tests/micropython/viper_args.py
+++ b/tests/micropython/viper_args.py
@@ -25,7 +25,15 @@ def f4(x1:int, x2:int, x3:int, x4:int):
print(x1, x2, x3, x4)
f4(1, 2, 3, 4)
-# only up to 4 arguments currently supported
+@micropython.viper
+def f5(x1:int, x2:int, x3:int, x4:int, x5:int):
+ print(x1, x2, x3, x4, x5)
+f5(1, 2, 3, 4, 5)
+
+@micropython.viper
+def f6(x1:int, x2:int, x3:int, x4:int, x5:int, x6:int):
+ print(x1, x2, x3, x4, x5, x6)
+f6(1, 2, 3, 4, 5, 6)
# test compiling *x, **x, * args (currently unsupported at runtime)
@micropython.viper
diff --git a/tests/micropython/viper_args.py.exp b/tests/micropython/viper_args.py.exp
index 0ca0f4e90..6d64c584a 100644
--- a/tests/micropython/viper_args.py.exp
+++ b/tests/micropython/viper_args.py.exp
@@ -3,3 +3,5 @@
1 2
1 2 3
1 2 3 4
+1 2 3 4 5
+1 2 3 4 5 6
diff --git a/tests/micropython/viper_error.py b/tests/micropython/viper_error.py
index 847257285..ff32f5473 100644
--- a/tests/micropython/viper_error.py
+++ b/tests/micropython/viper_error.py
@@ -13,9 +13,6 @@ test("@micropython.viper\ndef f() -> 1: pass")
# unknown type
test("@micropython.viper\ndef f(x:unknown_type): pass")
-# too many arguments
-test("@micropython.viper\ndef f(a, b, c, d, e): pass")
-
# local used before type known
test("""
@micropython.viper
diff --git a/tests/micropython/viper_error.py.exp b/tests/micropython/viper_error.py.exp
index 66bcad1f7..da9a0ca93 100644
--- a/tests/micropython/viper_error.py.exp
+++ b/tests/micropython/viper_error.py.exp
@@ -1,7 +1,6 @@
SyntaxError('annotation must be an identifier',)
SyntaxError('annotation must be an identifier',)
ViperTypeError("unknown type 'unknown_type'",)
-ViperTypeError("Viper functions don't currently support more than 4 arguments",)
ViperTypeError("local 'x' used before type known",)
ViperTypeError("local 'x' has type 'int' but source is 'object'",)
ViperTypeError("can't implicitly convert 'ptr' to 'bool'",)