[vala] dova: Report error if can't infer element type for list/set/map literals
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] dova: Report error if can't infer element type for list/set/map literals
- Date: Wed, 15 Dec 2010 14:08:59 +0000 (UTC)
commit c83f7f3e839604ed29ea3563f0fbc058818e9b19
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Dec 15 15:01:05 2010 +0100
dova: Report error if can't infer element type for list/set/map literals
vala/valalistliteral.vala | 6 ++++++
vala/valamapliteral.vala | 12 ++++++++++++
vala/valasetliteral.vala | 6 ++++++
3 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/vala/valalistliteral.vala b/vala/valalistliteral.vala
index b8759d6..7438ca7 100644
--- a/vala/valalistliteral.vala
+++ b/vala/valalistliteral.vala
@@ -114,6 +114,12 @@ public class Vala.ListLiteral : Literal {
}
}
+ if (element_type == null) {
+ error = true;
+ Report.error (source_reference, "cannot infer element type for list literal");
+ return false;
+ }
+
element_type = element_type.copy ();
element_type.value_owned = true;
list_type.add_type_argument (element_type);
diff --git a/vala/valamapliteral.vala b/vala/valamapliteral.vala
index 3d1170d..e9eca0b 100644
--- a/vala/valamapliteral.vala
+++ b/vala/valamapliteral.vala
@@ -115,6 +115,18 @@ public class Vala.MapLiteral : Literal {
}
}
+ if (map_key_type == null) {
+ error = true;
+ Report.error (source_reference, "cannot infer key type for map literal");
+ return false;
+ }
+
+ if (map_value_type == null) {
+ error = true;
+ Report.error (source_reference, "cannot infer value type for map literal");
+ return false;
+ }
+
map_key_type = map_key_type.copy ();
map_key_type.value_owned = true;
map_value_type = map_value_type.copy ();
diff --git a/vala/valasetliteral.vala b/vala/valasetliteral.vala
index d0f1228..bf10e01 100644
--- a/vala/valasetliteral.vala
+++ b/vala/valasetliteral.vala
@@ -98,6 +98,12 @@ public class Vala.SetLiteral : Literal {
}
}
+ if (element_type == null) {
+ error = true;
+ Report.error (source_reference, "cannot infer element type for set literal");
+ return false;
+ }
+
element_type = element_type.copy ();
element_type.value_owned = true;
set_type.add_type_argument (element_type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]