[vala/wip/issue548: 27/34] vala: Add GenericType.get_actual_type()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue548: 27/34] vala: Add GenericType.get_actual_type()
- Date: Tue, 18 Dec 2018 21:13:44 +0000 (UTC)
commit 1ced9ceb982aaea630a9cedb1fcb5165fe1f9a45
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Dec 5 16:01:13 2018 +0100
vala: Add GenericType.get_actual_type()
vala/valadatatype.vala | 6 +-----
vala/valagenerictype.vala | 12 ++++++++++++
2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 09209a7fd..85d8fb87b 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -463,11 +463,7 @@ public abstract class Vala.DataType : CodeNode {
return result;
}
- if (result is GenericType) {
- result = SemanticAnalyzer.get_actual_type (derived_instance_type,
method_type_arguments, (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) {
+ if (result.type_argument_list != null) {
// recursely get actual types for type arguments
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_type_arguments, node_reference);
diff --git a/vala/valagenerictype.vala b/vala/valagenerictype.vala
index d964ab63a..0a229a43e 100644
--- a/vala/valagenerictype.vala
+++ b/vala/valagenerictype.vala
@@ -47,6 +47,18 @@ public class Vala.GenericType : DataType {
return result;
}
+ public override DataType get_actual_type (DataType? derived_instance_type, List<DataType>?
method_type_arguments, CodeNode node_reference) {
+ var result = this.copy ();
+
+ if (derived_instance_type == null && method_type_arguments == null) {
+ return result;
+ }
+
+ result = SemanticAnalyzer.get_actual_type (derived_instance_type, method_type_arguments,
(GenericType) result, node_reference);
+
+ return result;
+ }
+
public override DataType? infer_type_argument (TypeParameter type_param, DataType value_type) {
if (type_parameter == type_param) {
var ret = value_type.copy ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]