diff options
author | Jürg Billeter <j@bitron.ch> | 2009-10-18 16:04:08 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2009-10-18 16:04:08 +0200 |
commit | 80c18a1d1ff357be7f1d0f50f1aa331f206a0a0a (patch) | |
tree | fe949b36377f492318d6a1741107fc7737170cdd /vala/valanulltype.vala | |
parent | 4e818c1d8dc1a7683b220ed5cb0ebad69cd02ad0 (diff) | |
download | vala-80c18a1d1ff357be7f1d0f50f1aa331f206a0a0a.tar.gz |
Use strict non-null types with --enable-experimental-non-null
Do not consider local variables nullable or nullable types compatible
to non-null types when using --enable-experimental-non-null.
Diffstat (limited to 'vala/valanulltype.vala')
-rw-r--r-- | vala/valanulltype.vala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/vala/valanulltype.vala b/vala/valanulltype.vala index f58cce38e..cbe041953 100644 --- a/vala/valanulltype.vala +++ b/vala/valanulltype.vala @@ -1,6 +1,6 @@ /* valanulltype.vala * - * Copyright (C) 2007-2008 Jürg Billeter + * Copyright (C) 2007-2009 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,10 +27,15 @@ using GLib; */ public class Vala.NullType : ReferenceType { public NullType (SourceReference source_reference) { + this.nullable = true; this.source_reference = source_reference; } public override bool compatible (DataType target_type) { + if (CodeContext.get ().experimental_non_null) { + return target_type.nullable; + } + if (!(target_type is PointerType) && (target_type is NullType || (target_type.data_type == null && target_type.type_parameter == null))) { return true; } @@ -64,4 +69,8 @@ public class Vala.NullType : ReferenceType { public override bool is_disposable () { return false; } + + public override string to_qualified_string (Scope? scope = null) { + return "null"; + } } |