]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Variadic parameters are not supported for async methods
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 19 Mar 2019 07:09:35 +0000 (08:09 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 10 Apr 2019 14:26:19 +0000 (16:26 +0200)
tests/Makefile.am
tests/asynchronous/variadic-invalid-2.test [new file with mode: 0644]
tests/asynchronous/variadic-invalid.test [new file with mode: 0644]
vala/valamethod.vala

index 73c87a6b964821bc054422fa2674d9d40b7362f9..4995cdf3a4c5465702453efd62f161bfb594a082 100644 (file)
@@ -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 (file)
index 0000000..cf4ee97
--- /dev/null
@@ -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 (file)
index 0000000..2e62113
--- /dev/null
@@ -0,0 +1,7 @@
+Invalid Code
+
+async void foo (string first, ...) {
+}
+
+void main () {
+}
index 166ed9d20fc2bfd21103dec0ffa8eb11f7e5c02e..9cdbcd676e890ebdb6942fa9715ddb551c26d2a1 100644 (file)
@@ -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;