From 201458e3bd2f1d79a0ea0b853552e9df267e92b1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 26 Dec 2016 20:44:10 -0800 Subject: 3713 - cross-link calls with definitions in html --- html/055shape_shifting_container.cc.html | 222 +++++++++++++++---------------- 1 file changed, 111 insertions(+), 111 deletions(-) (limited to 'html/055shape_shifting_container.cc.html') diff --git a/html/055shape_shifting_container.cc.html b/html/055shape_shifting_container.cc.html index 2ef1e5c9..40d5b834 100644 --- a/html/055shape_shifting_container.cc.html +++ b/html/055shape_shifting_container.cc.html @@ -96,13 +96,13 @@ if ('onhashchange' in window) { 34 const type_tree* get_base_type(const type_tree* t) { 35 const type_tree* result = t->atom ? t : t->left; 36 if (!result->atom) - 37 raise << "invalid type " << to_string(t) << '\n' << end(); + 37 raise << "invalid type " << to_string(t) << '\n' << end(); 38 return result; 39 } 40 41 :(scenario ill_formed_container) 42 % Hide_errors = true; - 43 def main [ + 43 def main [ 44 {1: ((foo) num)} <- copy 0 45 ] 46 # no crash @@ -112,7 +112,7 @@ if ('onhashchange' in window) { 50 x:_t 51 y:num 52 ] - 53 def main [ + 53 def main [ 54 1:foo:num <- merge 12, 13 55 3:foo:point <- merge 14, 15, 16 56 ] @@ -128,7 +128,7 @@ if ('onhashchange' in window) { 66 x:_a 67 y:_b 68 ] - 69 def main [ + 69 def main [ 70 1:foo:num:bool <- merge 34, 1/true 71 ] 72 $error: 0 @@ -138,10 +138,10 @@ if ('onhashchange' in window) { 76 x:_a 77 y:_b 78 ] - 79 def main [ + 79 def main [ 80 1:text <- new [abc] 81 # compound types for type ingredients - 82 {2: (foo number (address array character))} <- merge 34/x, 1:text/y + 82 {2: (foo number (address array character))} <- merge 34/x, 1:text/y 83 ] 84 $error: 0 85 @@ -152,9 +152,9 @@ if ('onhashchange' in window) { 90 ] 91 container bar:_a:_b [ 92 # dilated element - 93 {data: (foo _a (address _b))} + 93 {data: (foo _a (address _b))} 94 ] - 95 def main [ + 95 def main [ 96 1:text <- new [abc] 97 2:bar:num:@:char <- merge 34/x, 1:text/y 98 ] @@ -206,10 +206,10 @@ if ('onhashchange' in window) { 144 145 :(before "End container Name Refinements") 146 if (name.find(':') != string::npos) { -147 trace(9999, "parse") << "container has type ingredients; parsing" << end(); +147 trace(9999, "parse") << "container has type ingredients; parsing" << end(); 148 if (!read_type_ingredients(name, command)) { 149 // error; skip rest of the container definition and continue -150 slurp_balanced_bracket(in); +150 slurp_balanced_bracket(in); 151 return; 152 } 153 } @@ -228,62 +228,62 @@ if ('onhashchange' in window) { 166 const type_info& previous_info = get(Type, get(Type_ordinal, name)); 167 // we've already seen this container; make sure type ingredients match 168 if (!type_ingredients_match(type_ingredient_names, previous_info.type_ingredient_names)) { -169 raise << "headers of " << command << " '" << name << "' must use identical type ingredients\n" << end(); +169 raise << "headers of " << command << " '" << name << "' must use identical type ingredients\n" << end(); 170 return false; 171 } 172 return true; 173 } 174 // we haven't seen this container before 175 if (!contains_key(Type_ordinal, name) || get(Type_ordinal, name) == 0) -176 put(Type_ordinal, name, Next_type_ordinal++); -177 type_info& info = get_or_insert(Type, get(Type_ordinal, name)); +176 put(Type_ordinal, name, Next_type_ordinal++); +177 type_info& info = get_or_insert(Type, get(Type_ordinal, name)); 178 info.type_ingredient_names.swap(type_ingredient_names); 179 return true; 180 } 181 182 bool slurp_type_ingredients(istream& in, map<string, type_ordinal>& out, const string& container_name) { 183 int next_type_ordinal = START_TYPE_INGREDIENTS; -184 while (has_data(in)) { +184 while (has_data(in)) { 185 string curr = slurp_until(in, ':'); 186 if (curr.empty()) { -187 raise << container_name << ": empty type ingredients not permitted\n" << end(); +187 raise << container_name << ": empty type ingredients not permitted\n" << end(); 188 return false; 189 } 190 if (!starts_with(curr, "_")) { -191 raise << container_name << ": type ingredient '" << curr << "' must begin with an underscore\n" << end(); +191 raise << container_name << ": type ingredient '" << curr << "' must begin with an underscore\n" << end(); 192 return false; 193 } -194 if (out.find(curr) != out.end()) { -195 raise << container_name << ": can't repeat type ingredient name'" << curr << "' in a single container definition\n" << end(); +194 if (out.find(curr) != out.end()) { +195 raise << container_name << ": can't repeat type ingredient name'" << curr << "' in a single container definition\n" << end(); 196 return false; 197 } -198 put(out, curr, next_type_ordinal++); +198 put(out, curr, next_type_ordinal++); 199 } 200 return true; 201 } 202 203 bool type_ingredients_match(const map<string, type_ordinal>& a, const map<string, type_ordinal>& b) { -204 if (SIZE(a) != SIZE(b)) return false; -205 for (map<string, type_ordinal>::const_iterator p = a.begin(); p != a.end(); ++p) { +204 if (SIZE(a) != SIZE(b)) return false; +205 for (map<string, type_ordinal>::const_iterator p = a.begin(); p != a.end(); ++p) { 206 if (!contains_key(b, p->first)) return false; 207 if (p->second != get(b, p->first)) return false; 208 } 209 return true; 210 } 211 -212 :(before "End insert_container Special-cases") +212 :(before "End insert_container Special-cases") 213 // check for use of type ingredients 214 else if (is_type_ingredient_name(type->name)) { 215 type->value = get(info.type_ingredient_names, type->name); 216 } 217 :(code) 218 bool is_type_ingredient_name(const string& type) { -219 return starts_with(type, "_"); +219 return starts_with(type, "_"); 220 } 221 222 :(before "End Container Type Checks") 223 if (type->value >= START_TYPE_INGREDIENTS -224 && (type->value - START_TYPE_INGREDIENTS) < SIZE(get(Type, type->value).type_ingredient_names)) +224 && (type->value - START_TYPE_INGREDIENTS) < SIZE(get(Type, type->value).type_ingredient_names)) 225 return; 226 227 :(scenario size_of_shape_shifting_exclusive_container) @@ -291,7 +291,7 @@ if ('onhashchange' in window) { 229 x:_t 230 y:num 231 ] -232 def main [ +232 def main [ 233 1:foo:num <- merge 0/x, 34 234 3:foo:point <- merge 0/x, 15, 16 235 6:foo:point <- merge 1/y, 23 @@ -319,7 +319,7 @@ if ('onhashchange' in window) { 257 x:_t 258 y:num 259 ] -260 def main [ +260 def main [ 261 1:foo:point <- merge 14, 15, 16 262 2:num <- get 1:foo:point, y:offset 263 ] @@ -330,7 +330,7 @@ if ('onhashchange' in window) { 268 x:_t 269 y:num 270 ] -271 def main [ +271 def main [ 272 1:foo:point <- merge 14, 15, 16 273 2:point <- get 1:foo:point, x:offset 274 ] @@ -342,7 +342,7 @@ if ('onhashchange' in window) { 280 x:_t 281 y:num 282 ] -283 def main [ +283 def main [ 284 1:foo:&:point <- merge 34/unsafe, 48 285 3:&:point <- get 1:foo:&:point, x:offset 286 ] @@ -357,7 +357,7 @@ if ('onhashchange' in window) { 295 x:foo:point 296 y:num 297 ] -298 def main [ +298 def main [ 299 1:bar <- merge 14, 15, 16, 17 300 2:num <- get 1:bar, 1:offset 301 ] @@ -368,15 +368,15 @@ if ('onhashchange' in window) { 306 x:_a 307 y:_b 308 ] -309 def main [ +309 def main [ 310 1:text <- new [abc] -311 {2: (foo number (address array character))} <- merge 34/x, 1:text/y -312 3:text <- get {2: (foo number (address array character))}, y:offset +311 {2: (foo number (address array character))} <- merge 34/x, 1:text/y +312 3:text <- get {2: (foo number (address array character))}, y:offset 313 4:bool <- equal 1:text, 3:text 314 ] 315 +mem: storing 1 in location 4 316 -317 :(before "End element_type Special-cases") +317 :(before "End element_type Special-cases") 318 replace_type_ingredients(element, type, info, " while computing element type of container"); 319 :(before "Compute Container Size(element, full_type)") 320 replace_type_ingredients(element, full_type, container_info, location_for_error_messages); @@ -405,39 +405,39 @@ if ('onhashchange' in window) { 343 void replace_type_ingredients(reagent& element, const type_tree* caller_type, const type_info& info, const string& location_for_error_messages) { 344 if (contains_type_ingredient(element)) { 345 if (!caller_type->right) -346 raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); +346 raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); 347 replace_type_ingredients(element.type, caller_type->right, info, location_for_error_messages); 348 } 349 } 350 351 // replace all type_ingredients in element_type with corresponding elements of callsite_type -352 void replace_type_ingredients(type_tree* element_type, const type_tree* callsite_type, const type_info& container_info, const string& location_for_error_messages) { +352 void replace_type_ingredients(type_tree* element_type, const type_tree* callsite_type, const type_info& container_info, const string& location_for_error_messages) { 353 if (!callsite_type) return; // error but it's already been raised above 354 if (!element_type) return; 355 if (!element_type->atom) { -356 if (element_type->right == NULL && is_type_ingredient(element_type->left)) { -357 int type_ingredient_index = to_type_ingredient_index(element_type->left); +356 if (element_type->right == NULL && is_type_ingredient(element_type->left)) { +357 int type_ingredient_index = to_type_ingredient_index(element_type->left); 358 if (corresponding(callsite_type, type_ingredient_index, is_final_type_ingredient(type_ingredient_index, container_info))->right) { 359 // replacing type ingredient at end of list, and replacement is a non-degenerate compound type -- (a b) but not (a) -360 replace_type_ingredient_at(type_ingredient_index, element_type, callsite_type, container_info, location_for_error_messages); +360 replace_type_ingredient_at(type_ingredient_index, element_type, callsite_type, container_info, location_for_error_messages); 361 return; 362 } 363 } -364 replace_type_ingredients(element_type->left, callsite_type, container_info, location_for_error_messages); -365 replace_type_ingredients(element_type->right, callsite_type, container_info, location_for_error_messages); +364 replace_type_ingredients(element_type->left, callsite_type, container_info, location_for_error_messages); +365 replace_type_ingredients(element_type->right, callsite_type, container_info, location_for_error_messages); 366 return; 367 } -368 if (is_type_ingredient(element_type)) -369 replace_type_ingredient_at(to_type_ingredient_index(element_type), element_type, callsite_type, container_info, location_for_error_messages); +368 if (is_type_ingredient(element_type)) +369 replace_type_ingredient_at(to_type_ingredient_index(element_type), element_type, callsite_type, container_info, location_for_error_messages); 370 } 371 372 const type_tree* corresponding(const type_tree* type, int index, bool final) { 373 for (const type_tree* curr = type; curr; curr = curr->right, --index) { -374 assert_for_now(!curr->atom); +374 assert_for_now(!curr->atom); 375 if (index == 0) 376 return final ? curr : curr->left; 377 } -378 assert_for_now(false); +378 assert_for_now(false); 379 } 380 381 bool is_type_ingredient(const type_tree* type) { @@ -449,9 +449,9 @@ if ('onhashchange' in window) { 387 return type->value-START_TYPE_INGREDIENTS; 388 } 389 -390 void replace_type_ingredient_at(const int type_ingredient_index, type_tree* element_type, const type_tree* callsite_type, const type_info& container_info, const string& location_for_error_messages) { +390 void replace_type_ingredient_at(const int type_ingredient_index, type_tree* element_type, const type_tree* callsite_type, const type_info& container_info, const string& location_for_error_messages) { 391 if (!has_nth_type(callsite_type, type_ingredient_index)) { -392 raise << "illegal type " << names_to_string(callsite_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); +392 raise << "illegal type " << names_to_string(callsite_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); 393 return; 394 } 395 *element_type = *nth_type_ingredient(callsite_type, type_ingredient_index, container_info); @@ -475,7 +475,7 @@ if ('onhashchange' in window) { 413 414 bool is_final_type_ingredient(int type_ingredient_index, const type_info& container_info) { 415 for (map<string, type_ordinal>::const_iterator p = container_info.type_ingredient_names.begin(); -416 p != container_info.type_ingredient_names.end(); +416 p != container_info.type_ingredient_names.end(); 417 ++p) { 418 if (p->second > START_TYPE_INGREDIENTS+type_ingredient_index) return false; 419 } @@ -489,8 +489,8 @@ if ('onhashchange' in window) { 427 " y:num\n" 428 "]\n"); 429 reagent callsite("x:foo:point"); -430 reagent element = element_type(callsite.type, 0); -431 CHECK_EQ(to_string(element), "{x: \"point\"}"); +430 reagent element = element_type(callsite.type, 0); +431 CHECK_EQ(to_string(element), "{x: \"point\"}"); 432 } 433 434 void test_replace_type_ingredients_tail() { @@ -501,8 +501,8 @@ if ('onhashchange' in window) { 439 " x:foo:_elem\n" 440 "]\n"); 441 reagent callsite("x:bar:point"); -442 reagent element = element_type(callsite.type, 0); -443 CHECK_EQ(to_string(element), "{x: (\"foo\" \"point\")}"); +442 reagent element = element_type(callsite.type, 0); +443 CHECK_EQ(to_string(element), "{x: (\"foo\" \"point\")}"); 444 } 445 446 void test_replace_type_ingredients_head_tail_multiple() { @@ -512,9 +512,9 @@ if ('onhashchange' in window) { 450 "container bar:_elem [\n" 451 " x:foo:_elem\n" 452 "]\n"); -453 reagent callsite("x:bar:address:array:character"); -454 reagent element = element_type(callsite.type, 0); -455 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"array\" \"character\")}"); +453 reagent callsite("x:bar:address:array:character"); +454 reagent element = element_type(callsite.type, 0); +455 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"array\" \"character\")}"); 456 } 457 458 void test_replace_type_ingredients_head_middle() { @@ -525,8 +525,8 @@ if ('onhashchange' in window) { 463 " x:foo:_elem:num\n" 464 "]\n"); 465 reagent callsite("x:bar:address"); -466 reagent element = element_type(callsite.type, 0); -467 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"number\")}"); +466 reagent element = element_type(callsite.type, 0); +467 CHECK_EQ(to_string(element), "{x: (\"foo\" \"address\" \"number\")}"); 468 } 469 470 void test_replace_last_type_ingredient_with_multiple() { @@ -535,10 +535,10 @@ if ('onhashchange' in window) { 473 " y:_b\n" 474 "]\n"); 475 reagent callsite("{f: (foo number (address array character))}"); -476 reagent element1 = element_type(callsite.type, 0); -477 CHECK_EQ(to_string(element1), "{x: \"number\"}"); -478 reagent element2 = element_type(callsite.type, 1); -479 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); +476 reagent element1 = element_type(callsite.type, 0); +477 CHECK_EQ(to_string(element1), "{x: \"number\"}"); +478 reagent element2 = element_type(callsite.type, 1); +479 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); 480 } 481 482 void test_replace_last_type_ingredient_inside_compound() { @@ -546,8 +546,8 @@ if ('onhashchange' in window) { 484 " {x: (bar _a (address _b))}\n" 485 "]\n"); 486 reagent callsite("f:foo:number:array:character"); -487 reagent element = element_type(callsite.type, 0); -488 CHECK_EQ(names_to_string_without_quotes(element.type), "(bar number (address array character))"); +487 reagent element = element_type(callsite.type, 0); +488 CHECK_EQ(names_to_string_without_quotes(element.type), "(bar number (address array character))"); 489 } 490 491 void test_replace_middle_type_ingredient_with_multiple() { @@ -557,12 +557,12 @@ if ('onhashchange' in window) { 495 " z:_c\n" 496 "]\n"); 497 reagent callsite("{f: (foo number (address array character) boolean)}"); -498 reagent element1 = element_type(callsite.type, 0); -499 CHECK_EQ(to_string(element1), "{x: \"number\"}"); -500 reagent element2 = element_type(callsite.type, 1); -501 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); -502 reagent element3 = element_type(callsite.type, 2); -503 CHECK_EQ(to_string(element3), "{z: \"boolean\"}"); +498 reagent element1 = element_type(callsite.type, 0); +499 CHECK_EQ(to_string(element1), "{x: \"number\"}"); +500 reagent element2 = element_type(callsite.type, 1); +501 CHECK_EQ(to_string(element2), "{y: (\"address\" \"array\" \"character\")}"); +502 reagent element3 = element_type(callsite.type, 2); +503 CHECK_EQ(to_string(element3), "{z: \"boolean\"}"); 504 } 505 506 void test_replace_middle_type_ingredient_with_multiple2() { @@ -571,8 +571,8 @@ if ('onhashchange' in window) { 509 " value:_value\n" 510 "]\n"); 511 reagent callsite("{f: (foo (address array character) number)}"); -512 reagent element = element_type(callsite.type, 0); -513 CHECK_EQ(to_string(element), "{key: (\"address\" \"array\" \"character\")}"); +512 reagent element = element_type(callsite.type, 0); +513 CHECK_EQ(to_string(element), "{key: (\"address\" \"array\" \"character\")}"); 514 } 515 516 void test_replace_middle_type_ingredient_with_multiple3() { @@ -585,8 +585,8 @@ if ('onhashchange' in window) { 523 " value:_value\n" 524 "]\n"); 525 reagent callsite("{f: (foo_table (address array character) number)}"); -526 reagent element = element_type(callsite.type, 0); -527 CHECK_EQ(to_string(element), "{data: (\"address\" \"array\" \"foo_table_row\" (\"address\" \"array\" \"character\") \"number\")}"); +526 reagent element = element_type(callsite.type, 0); +527 CHECK_EQ(to_string(element), "{data: (\"address\" \"array\" \"foo_table_row\" (\"address\" \"array\" \"character\") \"number\")}"); 528 } 529 530 :(code) @@ -603,7 +603,7 @@ if ('onhashchange' in window) { 541 x:_t 542 y:num 543 ] -544 def main [ +544 def main [ 545 10:foo:point <- merge 14, 15, 16 546 1:num <- get 10:foo, 1:offset 547 ] @@ -618,12 +618,12 @@ if ('onhashchange' in window) { 556 :(before "End compute_container_sizes Non-atom Special-cases") 557 const type_tree* root = get_base_type(type); 558 type_info& info = get(Type, root->value); -559 if (info.kind == CONTAINER) { +559 if (info.kind == CONTAINER) { 560 compute_container_sizes(info, type, pending_metadata, location_for_error_messages); 561 return; 562 } -563 if (info.kind == EXCLUSIVE_CONTAINER) { -564 compute_exclusive_container_sizes(info, type, pending_metadata, location_for_error_messages); +563 if (info.kind == EXCLUSIVE_CONTAINER) { +564 compute_exclusive_container_sizes(info, type, pending_metadata, location_for_error_messages); 565 return; 566 } 567 @@ -635,7 +635,7 @@ if ('onhashchange' in window) { 573 "]\n"); 574 reagent r("x:foo:point"); 575 compute_container_sizes(r, ""); -576 CHECK_EQ(r.metadata.size, 3); +576 CHECK_EQ(r.metadata.size, 3); 577 } 578 579 void test_container_sizes_shape_shifting_exclusive_container() { @@ -645,10 +645,10 @@ if ('onhashchange' in window) { 583 "]\n"); 584 reagent r("x:foo:point"); 585 compute_container_sizes(r, ""); -586 CHECK_EQ(r.metadata.size, 3); +586 CHECK_EQ(r.metadata.size, 3); 587 reagent r2("x:foo:num"); 588 compute_container_sizes(r2, ""); -589 CHECK_EQ(r2.metadata.size, 2); +589 CHECK_EQ(r2.metadata.size, 2); 590 } 591 592 void test_container_sizes_compound_type_ingredient() { @@ -658,11 +658,11 @@ if ('onhashchange' in window) { 596 "]\n"); 597 reagent r("x:foo:&:point"); 598 compute_container_sizes(r, ""); -599 CHECK_EQ(r.metadata.size, 2); +599 CHECK_EQ(r.metadata.size, 2); 600 // scan also pre-computes metadata for type ingredient 601 reagent point("x:point"); -602 CHECK(contains_key(Container_metadata, point.type)); -603 CHECK_EQ(get(Container_metadata, point.type).size, 2); +602 CHECK(contains_key(Container_metadata, point.type)); +603 CHECK_EQ(get(Container_metadata, point.type).size, 2); 604 } 605 606 void test_container_sizes_recursive_shape_shifting_container() { @@ -672,18 +672,18 @@ if ('onhashchange' in window) { 610 "]\n"); 611 reagent r2("x:foo:num"); 612 compute_container_sizes(r2, ""); -613 CHECK_EQ(r2.metadata.size, 2); +613 CHECK_EQ(r2.metadata.size, 2); 614 } 615 616 :(before "End compute_container_address_offsets Non-atom Special-cases") 617 const type_tree* root = get_base_type(type); 618 type_info& info = get(Type, root->value); -619 if (info.kind == CONTAINER) { +619 if (info.kind == CONTAINER) { 620 compute_container_address_offsets(info, type, location_for_error_messages); 621 return; 622 } -623 if (info.kind == EXCLUSIVE_CONTAINER) { -624 compute_exclusive_container_address_offsets(info, type, location_for_error_messages); +623 if (info.kind == EXCLUSIVE_CONTAINER) { +624 compute_exclusive_container_address_offsets(info, type, location_for_error_messages); 625 return; 626 } 627 @@ -696,13 +696,13 @@ if ('onhashchange' in window) { 634 reagent r("x:foo:&:num"); 635 compute_container_sizes(r, ""); 636 compute_container_address_offsets(r, ""); -637 CHECK_EQ(SIZE(r.metadata.address), 1); -638 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); -639 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); -640 CHECK_EQ(SIZE(offset_info), 1); -641 CHECK_EQ(offset_info.begin()->offset, 1); // -642 CHECK(offset_info.begin()->payload_type->atom); -643 CHECK_EQ(offset_info.begin()->payload_type->name, "number"); +637 CHECK_EQ(SIZE(r.metadata.address), 1); +638 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); +639 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); +640 CHECK_EQ(SIZE(offset_info), 1); +641 CHECK_EQ(offset_info.begin()->offset, 1); // +642 CHECK(offset_info.begin()->payload_type->atom); +643 CHECK_EQ(offset_info.begin()->payload_type->name, "number"); 644 } 645 646 void test_container_address_offsets_in_nested_shape_shifting_container() { @@ -715,19 +715,19 @@ if ('onhashchange' in window) { 653 " y:foo:_t\n" 654 "]\n"); 655 reagent r("x:bar:&:num"); -656 CLEAR_TRACE; +656 CLEAR_TRACE; 657 compute_container_sizes(r, ""); 658 compute_container_address_offsets(r, ""); -659 CHECK_EQ(SIZE(r.metadata.address), 1); -660 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); -661 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); -662 CHECK_EQ(SIZE(offset_info), 2); -663 CHECK_EQ(offset_info.begin()->offset, 0); // -664 CHECK(offset_info.begin()->payload_type->atom); -665 CHECK_EQ(offset_info.begin()->payload_type->name, "number"); -666 CHECK_EQ((++offset_info.begin())->offset, 2); // -667 CHECK((++offset_info.begin())->payload_type->atom); -668 CHECK_EQ((++offset_info.begin())->payload_type->name, "number"); +659 CHECK_EQ(SIZE(r.metadata.address), 1); +660 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); +661 set<address_element_info>& offset_info = get(r.metadata.address, set<tag_condition_info>()); +662 CHECK_EQ(SIZE(offset_info), 2); +663 CHECK_EQ(offset_info.begin()->offset, 0); // +664 CHECK(offset_info.begin()->payload_type->atom); +665 CHECK_EQ(offset_info.begin()->payload_type->name, "number"); +666 CHECK_EQ((++offset_info.begin())->offset, 2); // +667 CHECK((++offset_info.begin())->payload_type->atom); +668 CHECK_EQ((++offset_info.begin())->payload_type->name, "number"); 669 } 670 671 //:: 'merge' on shape-shifting containers @@ -741,7 +741,7 @@ if ('onhashchange' in window) { 679 x:num 680 y:num 681 ] -682 def main [ +682 def main [ 683 1:foo:bar <- merge 23, 1/y, 34 684 ] 685 +mem: storing 23 in location 1 @@ -759,10 +759,10 @@ if ('onhashchange' in window) { 697 x:num 698 y:num 699 ] -700 def main [ +700 def main [ 701 1:foo:bar <- merge 23, 1/y, 34, 35 702 ] -703 +error: main: too many ingredients in '1:foo:bar <- merge 23, 1/y, 34, 35' +703 +error: main: too many ingredients in '1:foo:bar <- merge 23, 1/y, 34, 35' 704 705 :(scenario merge_check_shape_shifting_exclusive_container_containing_container) 706 exclusive-container foo:_elem [ @@ -773,7 +773,7 @@ if ('onhashchange' in window) { 711 x:num 712 y:num 713 ] -714 def main [ +714 def main [ 715 1:foo:bar <- merge 1/y, 23, 34 716 ] 717 +mem: storing 1 in location 1 @@ -790,7 +790,7 @@ if ('onhashchange' in window) { 728 x:num 729 y:num 730 ] -731 def main [ +731 def main [ 732 1:foo:bar <- merge 0/x, 23 733 ] 734 $error: 0 @@ -805,10 +805,10 @@ if ('onhashchange' in window) { 743 x:num 744 y:num 745 ] -746 def main [ +746 def main [ 747 1:foo:bar <- merge 1/y, 23 748 ] -749 +error: main: too few ingredients in '1:foo:bar <- merge 1/y, 23' +749 +error: main: too few ingredients in '1:foo:bar <- merge 1/y, 23' -- cgit 1.4.1-2-gfad0