From: Rico Tzschichholz Date: Tue, 19 Mar 2019 07:09:35 +0000 (+0100) Subject: vala: Variadic parameters are not supported for async methods X-Git-Tag: 0.42.7~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=533b21b3486f4474336e572934ec2b6792c7adad;p=thirdparty%2Fvala.git vala: Variadic parameters are not supported for async methods --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 73c87a6b9..4995cdf3a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -411,6 +411,8 @@ TESTS = \ asynchronous/closures.vala \ asynchronous/generator.vala \ asynchronous/result-pos.vala \ + asynchronous/variadic-invalid.test \ + asynchronous/variadic-invalid-2.test \ asynchronous/yield.vala \ generics/constructor-chain-up.vala \ generics/inference-static-function.vala \ diff --git a/tests/asynchronous/variadic-invalid-2.test b/tests/asynchronous/variadic-invalid-2.test new file mode 100644 index 000000000..cf4ee9705 --- /dev/null +++ b/tests/asynchronous/variadic-invalid-2.test @@ -0,0 +1,7 @@ +Invalid Code + +async void foo (string first, va_list vals) { +} + +void main () { +} diff --git a/tests/asynchronous/variadic-invalid.test b/tests/asynchronous/variadic-invalid.test new file mode 100644 index 000000000..2e62113ad --- /dev/null +++ b/tests/asynchronous/variadic-invalid.test @@ -0,0 +1,7 @@ +Invalid Code + +async void foo (string first, ...) { +} + +void main () { +} diff --git a/vala/valamethod.vala b/vala/valamethod.vala index 166ed9d20..9cdbcd676 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -737,6 +737,11 @@ public class Vala.Method : Subroutine, Callable { error = true; Report.error (param.source_reference, "Reference parameters are not supported for async methods"); } + if (!external_package && coroutine && (param.ellipsis || param.variable_type.data_type == context.analyzer.va_list_type.data_type)) { + error = true; + Report.error (param.source_reference, "Variadic parameters are not supported for async methods"); + return false; + } // TODO: begin and end parameters must be checked separately for coroutines if (coroutine) { continue;