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.45.1~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bcd543831d7dfb643191e495c20a9a48cc86226;p=thirdparty%2Fvala.git vala: Variadic parameters are not supported for async methods --- diff --git a/tests/Makefile.am b/tests/Makefile.am index f0000a94b..154f06eaa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -440,6 +440,8 @@ TESTS = \ asynchronous/generator.vala \ asynchronous/out-parameter-invalid.test \ 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 22980085f..7aef67416 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -804,6 +804,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;