[vala/0.52] vala: Correctly output signature of callable throwing error
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.52] vala: Correctly output signature of callable throwing error
- Date: Sun, 24 Oct 2021 13:13:07 +0000 (UTC)
commit 8a6376008cea099a1adc8612a993a5eb5d0828a5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Oct 21 17:42:37 2021 +0200
vala: Correctly output signature of callable throwing error
tests/Makefile.am | 2 ++
tests/delegates/incompatible-error-argument-2.test | 22 ++++++++++++++++++++++
tests/delegates/incompatible-error-argument.test | 21 +++++++++++++++++++++
vala/valacallabletype.vala | 2 +-
4 files changed, 46 insertions(+), 1 deletion(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 116a582e2..614b36a7c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -408,6 +408,8 @@ TESTS = \
delegates/incompatible.test \
delegates/incompatible-assignment.test \
delegates/incompatible-error-assignment.test \
+ delegates/incompatible-error-argument.test \
+ delegates/incompatible-error-argument-2.test \
delegates/incompatible-initializer.test \
delegates/incompatible-target.test \
delegates/instance-method-to-no-target.test \
diff --git a/tests/delegates/incompatible-error-argument-2.test
b/tests/delegates/incompatible-error-argument-2.test
new file mode 100644
index 000000000..50b422a52
--- /dev/null
+++ b/tests/delegates/incompatible-error-argument-2.test
@@ -0,0 +1,22 @@
+Invalid Code
+
+errordomain FooError {
+ FAIL;
+}
+
+errordomain BarError {
+ FAIL;
+}
+
+delegate void FooFunc () throws FooError;
+
+void bar () throws BarError {
+ throw new BarError.FAIL ("");
+}
+
+void foo (FooFunc f) {
+}
+
+void main () {
+ foo (bar);
+}
diff --git a/tests/delegates/incompatible-error-argument.test
b/tests/delegates/incompatible-error-argument.test
new file mode 100644
index 000000000..f98002288
--- /dev/null
+++ b/tests/delegates/incompatible-error-argument.test
@@ -0,0 +1,21 @@
+Invalid Code
+
+errordomain FooError {
+ FAIL;
+}
+
+errordomain BarError {
+ FAIL;
+}
+
+delegate void FooFunc () throws FooError;
+
+delegate void BarFunc () throws BarError;
+
+void foo (FooFunc f) {
+}
+
+void main () {
+ BarFunc bar = () => { throw new BarError.FAIL (""); };
+ foo (bar);
+}
diff --git a/vala/valacallabletype.vala b/vala/valacallabletype.vala
index a3da19518..f0e032204 100644
--- a/vala/valacallabletype.vala
+++ b/vala/valacallabletype.vala
@@ -127,7 +127,7 @@ public abstract class Vala.CallableType : DataType {
// Append error-types
var error_types = new ArrayList<DataType> ();
- get_error_types (error_types);
+ callable_symbol.get_error_types (error_types);
if (error_types.size > 0) {
builder.append (" throws ");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]