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.36.19~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ff6d08719d51b58cb189e5442a816ff4128fce6;p=thirdparty%2Fvala.git vala: Variadic parameters are not supported for async methods --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 54392247e..6fbf66e46 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -356,6 +356,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/bug694765-1.vala \ generics/bug694765-2.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 81ca7bb0d..1d00d9460 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -732,6 +732,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;