summaryrefslogtreecommitdiff
path: root/vala/valanulltype.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2009-10-18 16:04:08 +0200
committerJürg Billeter <j@bitron.ch>2009-10-18 16:04:08 +0200
commit80c18a1d1ff357be7f1d0f50f1aa331f206a0a0a (patch)
treefe949b36377f492318d6a1741107fc7737170cdd /vala/valanulltype.vala
parent4e818c1d8dc1a7683b220ed5cb0ebad69cd02ad0 (diff)
downloadvala-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.vala11
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";
+ }
}