[vala/wip/baedert/nullable: 4/4] datatype: Properly mark generic types nullable
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/baedert/nullable: 4/4] datatype: Properly mark generic types nullable
- Date: Tue, 1 Nov 2016 14:40:23 +0000 (UTC)
commit 8e49cbbb209bcb2cb0707824d7e87c1a8f1febb2
Author: Timm Bäder <mail baedert org>
Date: Tue Nov 1 15:39:09 2016 +0100
datatype: Properly mark generic types nullable
Breaks everything.
vala/valadatatype.vala | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index f3f9bf9..194ec9f 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -456,6 +456,13 @@ public abstract class Vala.DataType : CodeNode {
if (result is GenericType) {
result = SemanticAnalyzer.get_actual_type (derived_instance_type,
method_type_arguments, (GenericType) result, node_reference);
+ // For Foo<G> and new Foo<Some>, this will resolve every occurrence of G to
+ // 'Some', even though a) all generic types are nullable and
+ // b) G might be used in a nullable context, i.e. G?.
+ if (this.nullable && !(result is ValueType)) {
+ result.nullable = true;
+ }
+
// 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]