[vala/0.36] vala: Variadic constructors without a real first parameter are not allowed
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36] vala: Variadic constructors without a real first parameter are not allowed
- Date: Tue, 30 Jan 2018 07:24:56 +0000 (UTC)
commit d55e0ec568dc66fcfa6e65c3abe4e9a08e046764
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Jan 24 14:40:34 2018 +0100
vala: Variadic constructors without a real first parameter are not allowed
tests/Makefile.am | 1 +
tests/objects/constructor-variadic.test | 9 +++++++++
vala/valacreationmethod.vala | 6 ++++++
3 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8f026c0..3b13580 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -182,6 +182,7 @@ TESTS = \
delegates/bug792077.vala \
objects/chainup.vala \
objects/classes.vala \
+ objects/constructor-variadic.test \
objects/constructors.vala \
objects/dynamic.vala \
objects/generics.vala \
diff --git a/tests/objects/constructor-variadic.test b/tests/objects/constructor-variadic.test
new file mode 100644
index 0000000..ed9527d
--- /dev/null
+++ b/tests/objects/constructor-variadic.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+class Foo {
+ Foo (...) {
+ }
+}
+
+void main () {
+}
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 451dd81..4d90534 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -99,8 +99,14 @@ public class Vala.CreationMethod : Method {
}
context.analyzer.current_symbol = this;
+ int i = 0;
foreach (Parameter param in get_parameters()) {
param.check (context);
+ if (i == 0 && param.ellipsis && body != null) {
+ error = true;
+ Report.error (param.source_reference, "Named parameter required before
`...'");
+ }
+ i++;
}
foreach (DataType error_type in get_error_types ()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]