]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Do not report internal error for invalid code with nested generics
authorJürg Billeter <j@bitron.ch>
Thu, 6 Oct 2016 09:07:59 +0000 (11:07 +0200)
committerJürg Billeter <j@bitron.ch>
Thu, 6 Oct 2016 09:07:59 +0000 (11:07 +0200)
Reported-by: Matthias Berndt <matthias_berndt@gmx.de>
vala/valatypeparameter.vala

index 0fa3bd8ed37cf4397b4586501852538ad93374a6..de0023b0c9f1266081fc37e01dd862e85179e3c1 100644 (file)
@@ -49,12 +49,12 @@ public class Vala.TypeParameter : Symbol {
         *              otherwise
         */
        public bool equals (TypeParameter param2) {
-               /* only type parameters with the same parent are comparable */
-               if (parent_symbol != param2.parent_symbol) {
-                       Report.error (source_reference, "internal error: comparing type parameters with different parents");
+               /* only type parameters with a common scope are comparable */
+               if (!owner.is_subscope_of (param2.owner) && !param2.owner.is_subscope_of (owner)) {
+                       Report.error (source_reference, "internal error: comparing type parameters from different scopes");
                        return false;
                }
 
-               return name == param2.name;
+               return name == param2.name && parent_symbol == param2.parent_symbol;
        }
 }