[vala] Fix type checks for virtual and abstract properties



commit a383d0177b997906a8241b5b2c33aa9c93340553
Author: Jürg Billeter <j bitron ch>
Date:   Mon Jun 15 08:28:30 2009 +0200

    Fix type checks for virtual and abstract properties
    
    Take ownership into account when checking inherited properties.

 vala/valaproperty.vala |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index edcd656..e00510c 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -305,10 +305,6 @@ public class Vala.Property : Member, Lockable {
 	 *             property
 	 */
 	public bool equals (Property prop2) {
-		if (!prop2.property_type.equals (property_type)) {
-			return false;
-		}
-
 		if ((get_accessor == null && prop2.get_accessor != null) ||
 		    (get_accessor != null && prop2.get_accessor == null)) {
 			return false;
@@ -319,7 +315,21 @@ public class Vala.Property : Member, Lockable {
 			return false;
 		}
 
+		if (get_accessor != null) {
+			// check accessor value_type instead of property_type
+			// due to possible ownership differences
+			if (!prop2.get_accessor.value_type.equals (get_accessor.value_type)) {
+				return false;
+			}
+		}
+
 		if (set_accessor != null) {
+			// check accessor value_type instead of property_type
+			// due to possible ownership differences
+			if (!prop2.set_accessor.value_type.equals (set_accessor.value_type)) {
+				return false;
+			}
+
 			if (set_accessor.writable != prop2.set_accessor.writable) {
 				return false;
 			}



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