diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-11-30 21:26:15 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-12-20 00:51:37 +0100 |
commit | 7dcf56146e3e3cd4dd2129786c1e64e1e13ea4c0 (patch) | |
tree | 9ea0d113d2e2c37a08cf70c1426a8793742af298 /tests/objects/classes-interfaces.vala | |
parent | 3da2f97f02d6dcc359765080bf2f894a0519806d (diff) | |
download | vala-7dcf56146e3e3cd4dd2129786c1e64e1e13ea4c0.tar.gz |
codegen: Use properly checked implicit interface implementations
Collect implicit interface implementations in AST and avoid doing the same
checks twice.
This caused double vfunc assignments if an implementation is provided while
a method with the same name is available in prerequisite class.
See https://bugzilla.gnome.org/show_bug.cgi?id=536863
and https://bugzilla.gnome.org/show_bug.cgi?id=652098
Fixes https://gitlab.gnome.org/GNOME/vala/issues/548
Diffstat (limited to 'tests/objects/classes-interfaces.vala')
-rw-r--r-- | tests/objects/classes-interfaces.vala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/objects/classes-interfaces.vala b/tests/objects/classes-interfaces.vala new file mode 100644 index 000000000..9f2474653 --- /dev/null +++ b/tests/objects/classes-interfaces.vala @@ -0,0 +1,27 @@ +class Base : Object { + public void foo () { + } +} + +interface IFoo : Base { + public abstract string foo (); +} + +interface IBar : Base { + public abstract int foo (); +} + +class Manam : Base, IFoo, IBar { + public int IBar.foo () { + return 23; + } + public string IFoo.foo () { + return "foo"; + } +} + +void main () { + var manam = new Manam (); + assert (((IFoo) manam).foo () == "foo"); + assert (((IBar) manam).foo () == 23); +} |