[vala] Check type parameters when comparing types



commit 97de315bb903014975347949e513421599e76c9c
Author: Matthias Berndt <matthias_berndt gmx de>
Date:   Thu Jul 14 23:45:51 2016 +0200

    Check type parameters when comparing types
    
    Fix the broken implementation of TypeParameter.equals.
    
    Fixes bug 768823.

 tests/Makefile.am            |    1 +
 tests/objects/bug768823.test |   11 +++++++++++
 vala/valatypeparameter.vala  |    6 +-----
 3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3d264a6..23a4633 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -166,6 +166,7 @@ TESTS = \
        objects/bug702846.vala \
        objects/bug751338.vala \
        objects/bug767092.test \
+       objects/bug768823.test \
        errors/errors.vala \
        errors/bug567181.vala \
        errors/bug579101.vala \
diff --git a/tests/objects/bug768823.test b/tests/objects/bug768823.test
new file mode 100644
index 0000000..5fd4bbb
--- /dev/null
+++ b/tests/objects/bug768823.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+abstract class Foo<T> {
+       public abstract T t ();
+}
+
+class Bar<V, U> : Foo<U> {
+       public override V t () {
+               return null;
+       }
+}
diff --git a/vala/valatypeparameter.vala b/vala/valatypeparameter.vala
index 9912175..f875f30 100644
--- a/vala/valatypeparameter.vala
+++ b/vala/valatypeparameter.vala
@@ -49,10 +49,6 @@ public class Vala.TypeParameter : Symbol {
         *              otherwise
         */
        public bool equals (TypeParameter param2) {
-               // FIXME check whether the corresponding data type of one of the
-               //       parameters is a base type of the corresponding data
-               //       type of the other parameter and check along the path
-               //       whether one parameter maps to the other
-               return true;
+               return name == param2.name && parent_symbol == param2.parent_symbol;
        }
 }


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