Commit eaf1a1fe authored by Luca Bruno's avatar Luca Bruno

Fix crash due to not copying a type

parent 75359c3c
......@@ -235,14 +235,13 @@ public class Vala.ArrayType : ReferenceType {
}
public override DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
ArrayType result = (ArrayType) this.copy ();
if (derived_instance_type == null && method_access == null) {
return this;
return result;
}
ArrayType result = this;
if (element_type is GenericType || element_type.has_type_arguments ()) {
result = (ArrayType) result.copy ();
result.element_type = result.element_type.get_actual_type (derived_instance_type, method_access, node_reference);
}
......
......@@ -442,19 +442,18 @@ public abstract class Vala.DataType : CodeNode {
}
public virtual DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
DataType result = this.copy ();
if (derived_instance_type == null && method_access == null) {
return this;
return result;
}
DataType result = this;
if (result is GenericType) {
result = SemanticAnalyzer.get_actual_type (derived_instance_type, method_access, (GenericType) result, node_reference);
// don't try to resolve type arguments of returned actual type
// they can never be resolved and are not related to the instance type
} else if (result.type_argument_list != null) {
// recursely get actual types for type arguments
result = result.copy ();
for (int i = 0; i < result.type_argument_list.size; i++) {
result.type_argument_list[i] = result.type_argument_list[i].get_actual_type (derived_instance_type, method_access, node_reference);
}
......
......@@ -579,7 +579,7 @@ public class Vala.MethodCall : Expression {
}
}
formal_value_type = ret_type;
formal_value_type = ret_type.copy ();
value_type = formal_value_type.get_actual_type (target_object_type, call as MemberAccess, this);
bool may_throw = false;
......
......@@ -124,14 +124,13 @@ public class Vala.PointerType : DataType {
}
public override DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
PointerType result = (PointerType) this.copy ();
if (derived_instance_type == null && method_access == null) {
return this;
return result;
}
PointerType result = this;
if (base_type is GenericType || base_type.has_type_arguments ()) {
result = (PointerType) result.copy ();
result.base_type = result.base_type.get_actual_type (derived_instance_type, method_access, node_reference);
}
......
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