[vala/0.48] tests: Add "type-parameter property clash" test to increase coverage



commit bdf0781682d51fae8cf7c4b1b376a3e091317e7a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Dec 14 10:38:37 2021 +0100

    tests: Add "type-parameter property clash" test to increase coverage
    
    This needs to be handled gracefully. So throwing an error is no option.

 tests/Makefile.am                                 |  1 +
 tests/generics/type-parameter-property-clash.vala | 13 +++++++++++++
 2 files changed, 14 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0feacff33..7d3859832 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -718,6 +718,7 @@ TESTS = \
        generics/reference-transfer.vala \
        generics/string-literal-comparison.vala \
        generics/type-parameter-properties.vala \
+       generics/type-parameter-property-clash.vala \
        generics/value-pointer-type-access.vala \
        generics/bug640330.vala \
        generics/bug640330-2.test \
diff --git a/tests/generics/type-parameter-property-clash.vala 
b/tests/generics/type-parameter-property-clash.vala
new file mode 100644
index 000000000..760f5d1fc
--- /dev/null
+++ b/tests/generics/type-parameter-property-clash.vala
@@ -0,0 +1,13 @@
+class Foo<G> : Object {
+       public Type foo_g_type { get { return typeof (G); } }
+}
+
+class Bar<G> : Foo<G> {
+       public Type bar_g_type { get { return typeof (G); } }
+}
+
+void main () {
+       var bar = new Bar<string> ();
+       assert (bar.bar_g_type == typeof (string));
+       assert (bar.foo_g_type == typeof (string));
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]