]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: "??" evaluates both of sides of expression when right side throws error
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 8 Nov 2016 14:02:24 +0000 (15:02 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 11 Mar 2019 12:52:38 +0000 (13:52 +0100)
https://gitlab.gnome.org/GNOME/vala/issues/534

tests/Makefile.am
tests/control-flow/bug764440.vala [new file with mode: 0644]

index 5feb183f00240a56d902d92d4c6c80a93e81cb7e..1815c0b178d84589603de3b610f2de37fa5bc299 100644 (file)
@@ -168,6 +168,7 @@ TESTS = \
        control-flow/bug691514.vala     \
        control-flow/bug736774-1.vala \
        control-flow/bug736774-2.vala \
+       control-flow/bug764440.vala \
        control-flow/bug790903.test \
        control-flow/bug790903-2.test \
        control-semantic/argument-extra.test \
diff --git a/tests/control-flow/bug764440.vala b/tests/control-flow/bug764440.vala
new file mode 100644 (file)
index 0000000..6f1caae
--- /dev/null
@@ -0,0 +1,17 @@
+errordomain FooError {
+       BAR;
+}
+
+unowned string get_bar () throws FooError {
+       throw new FooError.BAR ("bar");
+}
+
+void main () {
+       try {
+               unowned string? foo = "foo";
+               unowned string bar = foo ?? get_bar ();
+               print ("%s\n", bar);
+       } catch {
+               assert_not_reached ();
+       }
+}