vala r884 - in trunk: . gee vala



Author: juergbi
Date: Tue Jan 22 17:05:24 2008
New Revision: 884
URL: http://svn.gnome.org/viewvc/vala?rev=884&view=rev

Log:
2008-01-22  Juerg Billeter  <j bitron ch>

	* vala/valasemanticanalyzer.vala: check type of variable initializer

	* gee/hashmap.vala, gee/hashset.vala, vala/valasymbol.vala: fix invalid
	  variable initializers


Modified:
   trunk/ChangeLog
   trunk/gee/hashmap.vala
   trunk/gee/hashset.vala
   trunk/vala/valasemanticanalyzer.vala
   trunk/vala/valasymbol.vala

Modified: trunk/gee/hashmap.vala
==============================================================================
--- trunk/gee/hashmap.vala	(original)
+++ trunk/gee/hashmap.vala	Tue Jan 22 17:05:24 2008
@@ -141,7 +141,7 @@
 	private void resize () {
 		if ((_array_size >= 3 * _nnodes && _array_size >= MIN_SIZE) ||
 		    (3 * _array_size <= _nnodes && _array_size < MAX_SIZE)) {
-			int new_array_size = SpacedPrimes.closest (_nnodes);
+			int new_array_size = (int) SpacedPrimes.closest (_nnodes);
 			new_array_size = new_array_size.clamp (MIN_SIZE, MAX_SIZE);
 
 			Node<K,V>[] new_nodes = new Node<K,V>[new_array_size];

Modified: trunk/gee/hashset.vala
==============================================================================
--- trunk/gee/hashset.vala	(original)
+++ trunk/gee/hashset.vala	Tue Jan 22 17:05:24 2008
@@ -126,7 +126,7 @@
 	private void resize () {
 		if ((_array_size >= 3 * _nnodes && _array_size >= MIN_SIZE) ||
 		    (3 * _array_size <= _nnodes && _array_size < MAX_SIZE)) {
-			int new_array_size = SpacedPrimes.closest (_nnodes);
+			int new_array_size = (int) SpacedPrimes.closest (_nnodes);
 			new_array_size = new_array_size.clamp (MIN_SIZE, MAX_SIZE);
 
 			Node<G>[] new_nodes = new Node<G>[new_array_size];

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Tue Jan 22 17:05:24 2008
@@ -738,6 +738,12 @@
 				}
 			}
 
+			if (!decl.initializer.static_type.compatible (decl.type_reference)) {
+				decl.error = true;
+				Report.error (decl.source_reference, "Assignment: Cannot convert from `%s' to `%s'".printf (decl.initializer.static_type.to_string (), decl.type_reference.to_string ()));
+				return;
+			}
+
 			if (decl.initializer.static_type.transfers_ownership) {
 				/* rhs transfers ownership of the expression */
 				if (!(decl.type_reference is PointerType) && !decl.type_reference.takes_ownership) {

Modified: trunk/vala/valasymbol.vala
==============================================================================
--- trunk/vala/valasymbol.vala	(original)
+++ trunk/vala/valasymbol.vala	Tue Jan 22 17:05:24 2008
@@ -1,6 +1,6 @@
 /* valasymbol.vala
  *
- * Copyright (C) 2006-2007  JÃrg Billeter
+ * Copyright (C) 2006-2008  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
@@ -202,7 +202,7 @@
 				if (!prev_upper || (i.len () >= 2 && !next_upper)) {
 					/* previous character wasn't upper case or
 					 * next character isn't upper case*/
-					int len = result.str.len ();
+					long len = result.str.len ();
 					if (len != 1 && result.str.offset (len - 2).get_char () != '_') {
 						/* we're not creating 1 character words */
 						result.append_c ('_');



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