]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Check type parameters when comparing types
authorMatthias Berndt <matthias_berndt@gmx.de>
Thu, 14 Jul 2016 21:45:51 +0000 (23:45 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 15 Jul 2016 03:21:23 +0000 (05:21 +0200)
Fix the broken implementation of TypeParameter.equals.

Fixes bug 768823.

tests/Makefile.am
tests/objects/bug768823.test [new file with mode: 0644]
vala/valatypeparameter.vala

index 3d264a65b557e3024647e580809a3addcc596a3b..23a46332c1d410fb05783394b9ae85cfbbee1ad0 100644 (file)
@@ -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 (file)
index 0000000..5fd4bbb
--- /dev/null
@@ -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;
+       }
+}
index 9912175a9d30b6c3c52128ac2b96c8f1b9295afd..f875f304dfd9799aa3e3bf6efc8383b73733aad1 100644 (file)
@@ -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;
        }
 }