[vala] Check compatibility of generic type arguments
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Check compatibility of generic type arguments
- Date: Wed, 3 Jun 2009 05:06:35 -0400 (EDT)
commit cf411029c40fc4b298733decdf5d1da034037e77
Author: Jürg Billeter <j bitron ch>
Date: Wed Jun 3 11:05:29 2009 +0200
Check compatibility of generic type arguments
Fixes bug 520952.
---
vala/valadatatype.vala | 17 +++++++++++++++++
vapigen/valavapicheck.vala | 2 +-
2 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 8150fb9..97d681f 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -328,6 +328,23 @@ public abstract class Vala.DataType : CodeNode {
}
if (data_type == target_type.data_type) {
+ // check compatibility of generic type arguments
+ if (type_argument_list != null
+ && type_argument_list.size > 0
+ && type_argument_list.size == target_type.get_type_arguments ().size) {
+ for (int i = 0; i < type_argument_list.size; i++) {
+ var type_arg = type_argument_list[i];
+ var target_type_arg = target_type.get_type_arguments ()[i];
+ // mutable generic types require type argument equality,
+ // not just one way compatibility
+ // as we do not currently have immutable generic container types,
+ // the additional check would be very inconvenient, so we
+ // skip the additional check for now
+ if (!type_arg.compatible (target_type_arg)) {
+ return false;
+ }
+ }
+ }
return true;
}
diff --git a/vapigen/valavapicheck.vala b/vapigen/valavapicheck.vala
index 50ecd92..6122a01 100644
--- a/vapigen/valavapicheck.vala
+++ b/vapigen/valavapicheck.vala
@@ -84,7 +84,7 @@ class Vala.VAPICheck : Object {
case IdlNodeTypeId.FUNCTION:
parse_members (((IdlNodeFunction) node).symbol,
- ((IdlNodeFunction) node).parameters);
+ (List<IdlNode>) ((IdlNodeFunction) node).parameters);
break;
case IdlNodeTypeId.BOXED:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]