diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-11-08 16:17:58 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-11-08 16:33:37 +0100 |
commit | 6690ea0e3c6f0d81d849e13548efc8c0809149cc (patch) | |
tree | 8c6bcea2cd7cbe3a6cc0c942d4ec3c056307b0dd /tests/delegates | |
parent | 42dca9175240a0cfa5c002c271eb53b29afe5b7a (diff) | |
download | vala-6690ea0e3c6f0d81d849e13548efc8c0809149cc.tar.gz |
vala: Improve check of delegate assignments and initializers
Fixes https://gitlab.gnome.org/GNOME/vala/issues/875
Diffstat (limited to 'tests/delegates')
-rw-r--r-- | tests/delegates/incompatible-assignment.test | 15 | ||||
-rw-r--r-- | tests/delegates/incompatible-initializer.test | 14 | ||||
-rw-r--r-- | tests/delegates/instance-method-to-no-target-2.test | 15 |
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/delegates/incompatible-assignment.test b/tests/delegates/incompatible-assignment.test new file mode 100644 index 000000000..1cd8c9fac --- /dev/null +++ b/tests/delegates/incompatible-assignment.test @@ -0,0 +1,15 @@ +Invalid Code + +[CCode (has_target = false)] +delegate void Foo (string s); + +class Bar { + public void foo () { + } +} + +void main () { + var bar = new Bar (); + Foo foo; + foo = bar.foo; +} diff --git a/tests/delegates/incompatible-initializer.test b/tests/delegates/incompatible-initializer.test new file mode 100644 index 000000000..0a23d4aa9 --- /dev/null +++ b/tests/delegates/incompatible-initializer.test @@ -0,0 +1,14 @@ +Invalid Code + +[CCode (has_target = false)] +delegate void Foo (string s); + +class Bar { + public void foo () { + } +} + +void main () { + var bar = new Bar (); + Foo foo = bar.foo; +} diff --git a/tests/delegates/instance-method-to-no-target-2.test b/tests/delegates/instance-method-to-no-target-2.test new file mode 100644 index 000000000..124fbdb5e --- /dev/null +++ b/tests/delegates/instance-method-to-no-target-2.test @@ -0,0 +1,15 @@ +Invalid Code + +[CCode (has_target = false)] +delegate void Foo (); + +class Bar { + public void foo () { + } +} + +void main () { + var bar = new Bar (); + Foo foo; + foo = bar.foo; +} |