vala r1229 - in trunk: . vala vapi



Author: juergbi
Date: Mon Apr 14 20:54:28 2008
New Revision: 1229
URL: http://svn.gnome.org/viewvc/vala?rev=1229&view=rev

Log:
2008-04-14  Juerg Billeter  <j bitron ch>

	* vala/valasemanticanalyzer.vala: report warning when using null
	  literal as argument for non-null parameter

	* vapi/glib-2.0.vapi: fix warnings


Modified:
   trunk/ChangeLog
   trunk/vala/valasemanticanalyzer.vala
   trunk/vapi/glib-2.0.vapi

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Mon Apr 14 20:54:28 2008
@@ -1822,12 +1822,12 @@
 					// disallow untyped arguments except for type inference of callbacks
 					if (!(param.type_reference is DelegateType) || !(arg.symbol_reference is Method)) {
 						expr.error = true;
-						Report.error (expr.source_reference, "Invalid type for argument %d".printf (i + 1));
+						Report.error (arg.source_reference, "Invalid type for argument %d".printf (i + 1));
 						return false;
 					}
 				} else if (!arg.static_type.compatible (param.type_reference)) {
 					expr.error = true;
-					Report.error (expr.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.static_type.to_string (), param.type_reference.to_string ()));
+					Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.static_type.to_string (), param.type_reference.to_string ()));
 					return false;
 				} else {
 					// 0 => null, 1 => in, 2 => ref, 3 => out
@@ -1846,25 +1846,27 @@
 					if (arg_type == 0) {
 						if (param.type_reference.is_ref) {
 							expr.error = true;
-							Report.error (expr.source_reference, "Argument %d: Cannot pass null to reference parameter".printf (i + 1));
+							Report.error (arg.source_reference, "Argument %d: Cannot pass null to reference parameter".printf (i + 1));
 							return false;
+						} else if (!param.type_reference.is_out && !param.type_reference.nullable) {
+							Report.warning (arg.source_reference, "Argument %d: Cannot pass null to non-null parameter type".printf (i + 1));
 						}
 					} else if (arg_type == 1) {
 						if (param.type_reference.is_ref || param.type_reference.is_out) {
 							expr.error = true;
-							Report.error (expr.source_reference, "Argument %d: Cannot pass value to reference or output parameter".printf (i + 1));
+							Report.error (arg.source_reference, "Argument %d: Cannot pass value to reference or output parameter".printf (i + 1));
 							return false;
 						}
 					} else if (arg_type == 2) {
 						if (!param.type_reference.is_ref) {
 							expr.error = true;
-							Report.error (expr.source_reference, "Argument %d: Cannot pass ref argument to non-reference parameter".printf (i + 1));
+							Report.error (arg.source_reference, "Argument %d: Cannot pass ref argument to non-reference parameter".printf (i + 1));
 							return false;
 						}
 					} else if (arg_type == 3) {
 						if (!param.type_reference.is_out) {
 							expr.error = true;
-							Report.error (expr.source_reference, "Argument %d: Cannot pass out argument to non-output parameter".printf (i + 1));
+							Report.error (arg.source_reference, "Argument %d: Cannot pass out argument to non-output parameter".printf (i + 1));
 							return false;
 						}
 					}

Modified: trunk/vapi/glib-2.0.vapi
==============================================================================
--- trunk/vapi/glib-2.0.vapi	(original)
+++ trunk/vapi/glib-2.0.vapi	Mon Apr 14 20:54:28 2008
@@ -429,7 +429,7 @@
 	public UnicodeType type ();
 	public UnicodeBreakType break_type ();
 
-	public int to_utf8 (string outbuf);
+	public int to_utf8 (string? outbuf);
 }
 
 [CCode (cprefix = "G_UNICODE_")]
@@ -2193,7 +2193,7 @@
 		public bool get_ignore_unknown_options ();
 		public string get_help (bool main_help, OptionGroup group);
 		[NoArrayLength]
-		public void add_main_entries (OptionEntry[] entries, string translation_domain);
+		public void add_main_entries (OptionEntry[] entries, string? translation_domain);
 		public void add_group (OptionGroup# group);
 		public void set_main_group (OptionGroup# group);
 		public weak OptionGroup get_main_group ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]