diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-11-02 07:37:33 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-11-04 08:08:39 +0100 |
commit | a06892eaa472ad26233ddcbcfbaf8ebdf12015f8 (patch) | |
tree | 4fa0105e198bff6792d1ac8480968dac6ba510d2 /tests/generics | |
parent | 940489070c2373e85cc79793b06bff4f0a69fc03 (diff) | |
download | vala-a06892eaa472ad26233ddcbcfbaf8ebdf12015f8.tar.gz |
codegen: Make type-parameter properties readable
Those are immutable while being construct-only properties.
See https://gitlab.gnome.org/GNOME/vala/issues/190
Diffstat (limited to 'tests/generics')
-rw-r--r-- | tests/generics/type-parameter-properties.vala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/generics/type-parameter-properties.vala b/tests/generics/type-parameter-properties.vala new file mode 100644 index 000000000..3004d198a --- /dev/null +++ b/tests/generics/type-parameter-properties.vala @@ -0,0 +1,29 @@ +class Foo<G> : Object { +} + +class Bar<T> : Foo<T> { +} + +void main () { + var bar = new Bar<string> (); + { + Type type; + BoxedCopyFunc dup_func; + DestroyNotify destroy_func; + + bar.get ("t-type", out type, "t-dup-func", out dup_func, "t-destroy-func", out destroy_func); + assert (type == typeof(string)); + assert (dup_func == (BoxedCopyFunc) string.dup); + assert (destroy_func == (DestroyNotify) free); + } + { + Type type; + BoxedCopyFunc dup_func; + DestroyNotify destroy_func; + + bar.get ("g-type", out type, "g-dup-func", out dup_func, "g-destroy-func", out destroy_func); + assert (type == typeof(string)); + assert (dup_func == (BoxedCopyFunc) string.dup); + assert (destroy_func == (DestroyNotify) free); + } +} |