Commit a6928466 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

don't crash when comparing value type with null

2006-10-24  Jürg Billeter  <j@bitron.ch>

	* vala/valasemanticanalyzer.vala: don't crash when comparing value type
	  with null

svn path=/trunk/; revision=147
parent 3000b0d6
2006-10-24 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala: don't crash when comparing value type
with null
2006-10-24 Jürg Billeter <j@bitron.ch>
* vala/valasymbolresolver.vala: don't crash on already resolved type
......
......@@ -828,15 +828,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
return (expression_type.data_type == null && expected_type.type_parameter == null);
}
/* null can be cast to any reference or array type */
if (expression_type.data_type == null &&
(expected_type.type_parameter != null ||
expected_type.data_type.is_reference_type () ||
expected_type.reference_to_value_type ||
expected_type.data_type is Array ||
expected_type.data_type is Callback ||
expected_type.data_type == pointer_type)) {
return true;
if (expression_type.data_type == null) {
/* null can be cast to any reference or array type */
if (expected_type.type_parameter != null ||
expected_type.data_type.is_reference_type () ||
expected_type.reference_to_value_type ||
expected_type.data_type is Array ||
expected_type.data_type is Callback ||
expected_type.data_type == pointer_type) {
return true;
}
/* null is not compatible with any other type (i.e. value types) */
return false;
}
/* temporarily ignore type parameters */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment