[vala] Fix crash when unable to infer generic type arguments



commit 9f0dc9988023a561d312cfe2b98bc4cd2dfae1d9
Author: Jürg Billeter <j bitron ch>
Date:   Sun Mar 21 19:44:58 2010 +0100

    Fix crash when unable to infer generic type arguments

 vala/valamethodcall.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 01adb4f..a148699 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -580,7 +580,7 @@ public class Vala.MethodCall : Expression {
 						}
 
 						// infer type arguments from expected return type
-						if (type_arg == null) {
+						if (type_arg == null && target_type != null) {
 							var generic_type = m.return_type as GenericType;
 							if (generic_type != null && generic_type.type_parameter == type_param) {
 								type_arg = target_type.copy ();
@@ -589,7 +589,9 @@ public class Vala.MethodCall : Expression {
 						}
 
 						if (type_arg == null) {
+							error = true;
 							Report.error (ma.source_reference, "cannot infer generic type argument for type parameter `%s'".printf (type_param.get_full_name ()));
+							return false;
 						}
 
 						ma.add_type_argument (type_arg);



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