[vala/0.36] vala: Variadic parameters are not supported for async methods
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36] vala: Variadic parameters are not supported for async methods
- Date: Wed, 10 Apr 2019 13:24:58 +0000 (UTC)
commit 5ff6d08719d51b58cb189e5442a816ff4128fce6
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Mar 19 08:09:35 2019 +0100
vala: Variadic parameters are not supported for async methods
tests/Makefile.am | 2 ++
tests/asynchronous/variadic-invalid-2.test | 7 +++++++
tests/asynchronous/variadic-invalid.test | 7 +++++++
vala/valamethod.vala | 5 +++++
4 files changed, 21 insertions(+)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]