From 621c64b538500528e4d95b32888a0eaf5dffeec8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 11 Sep 2016 17:53:11 -0700 Subject: 3325 --- 018type_abbreviations.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/018type_abbreviations.cc b/018type_abbreviations.cc index 9e907ae9..1fc0f432 100644 --- a/018type_abbreviations.cc +++ b/018type_abbreviations.cc @@ -69,13 +69,18 @@ void load_type_abbreviations(istream& in) { } type_tree* new_type_tree(const string& x) { - string_tree* type_names = new string_tree(x); - type_names = parse_string_tree(type_names); + string_tree* type_names = starts_with(x, "(") ? parse_string_tree(x) : parse_string_list(x); type_tree* result = new_type_tree(type_names); delete type_names; return result; } +string_tree* parse_string_list(const string& s) { + istringstream in(s); + in >> std::noskipws; + return parse_property_list(in); +} + :(scenario type_error1) % Hide_errors = true; type foo @@ -97,6 +102,13 @@ type foo = bar type foo = baz +error: 'type' conflict: 'foo' defined as both 'bar' and 'baz' +:(scenario type_abbreviation_for_compound) +type foo = address:number +def main [ + a:foo <- copy 0 +] ++run: {a: ("address" "number")} <- copy {0: "literal"} + //:: A few default abbreviations. :(before "End Mu Types Initialization") -- cgit 1.4.1-2-gfad0