Commit cf411029 authored by Jürg Billeter's avatar Jürg Billeter

Check compatibility of generic type arguments

Fixes bug 520952.
parent 9460d48c
......@@ -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;
}
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment