[vala/staging: 2/2] Report internal error for invalid type parameter comparison



commit b0191489cb87d15b7c97bb82af2269de6c80fadb
Author: Jürg Billeter <j bitron ch>
Date:   Fri Jul 15 05:16:46 2016 +0200

    Report internal error for invalid type parameter comparison

 vala/valatypeparameter.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/vala/valatypeparameter.vala b/vala/valatypeparameter.vala
index f875f30..0fa3bd8 100644
--- a/vala/valatypeparameter.vala
+++ b/vala/valatypeparameter.vala
@@ -49,6 +49,12 @@ public class Vala.TypeParameter : Symbol {
         *              otherwise
         */
        public bool equals (TypeParameter param2) {
-               return name == param2.name && parent_symbol == param2.parent_symbol;
+               /* 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");
+                       return false;
+               }
+
+               return name == param2.name;
        }
 }


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