From c5e4a41aa590f355ce4b6b9f0beb6936526d9e1e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 20 Aug 2017 04:39:07 -0700 Subject: 3974 --- 046check_type_by_name.cc | 159 ++++++++++++++++++++++++++ 047check_type_by_name.cc | 159 -------------------------- html/046check_type_by_name.cc.html | 227 +++++++++++++++++++++++++++++++++++++ html/047check_type_by_name.cc.html | 227 ------------------------------------- html/050scenario.cc.html | 4 +- 5 files changed, 388 insertions(+), 388 deletions(-) create mode 100644 046check_type_by_name.cc delete mode 100644 047check_type_by_name.cc create mode 100644 html/046check_type_by_name.cc.html delete mode 100644 html/047check_type_by_name.cc.html diff --git a/046check_type_by_name.cc b/046check_type_by_name.cc new file mode 100644 index 00000000..83b80571 --- /dev/null +++ b/046check_type_by_name.cc @@ -0,0 +1,159 @@ +//: Some simple sanity checks for types, and also attempts to guess them where +//: they aren't provided. +//: +//: You still have to provide the full type the first time you mention a +//: variable in a recipe. You have to explicitly name :offset and :variant +//: every single time. You can't use the same name with multiple types in a +//: single recipe. + +:(scenario transform_fails_on_reusing_name_with_different_type) +% Hide_errors = true; +def main [ + x:num <- copy 1 + x:bool <- copy 1 +] ++error: main: 'x' used with multiple types + +:(after "Transform.push_back(expand_type_abbreviations)") +Transform.push_back(check_or_set_types_by_name); // idempotent + +:(code) +void check_or_set_types_by_name(const recipe_ordinal r) { + trace(9991, "transform") << "--- deduce types for recipe " << get(Recipe, r).name << end(); + recipe& caller = get(Recipe, r); + set known; + for (int i = 0; i < SIZE(caller.steps); ++i) { + instruction& inst = caller.steps.at(i); + for (int in = 0; in < SIZE(inst.ingredients); ++in) { + deduce_missing_type(known, inst.ingredients.at(in)); + check_type(known, inst.ingredients.at(in), caller); + } + for (int out = 0; out < SIZE(inst.products); ++out) { + deduce_missing_type(known, inst.products.at(out)); + check_type(known, inst.products.at(out), caller); + } + } +} + +void deduce_missing_type(set& known, reagent& x) { + if (x.type) return; + if (is_jump_target(x.name)) { + x.type = new type_tree("label"); + return; + } + if (known.find(x) == known.end()) return; + x.type = new type_tree(*known.find(x)->type); + trace(9992, "transform") << x.name << " <= " << names_to_string(x.type) << end(); +} + +void check_type(set& known, const reagent& x, const recipe& caller) { + if (is_literal(x)) return; + if (is_integer(x.name)) return; // if you use raw locations you're probably doing something unsafe + if (!x.type) return; // might get filled in by other logic later + if (is_jump_target(x.name)) { + if (!x.type->atom || x.type->name != "label") + raise << maybe(caller.name) << "non-label '" << x.name << "' must begin with a letter\n" << end(); + return; + } + if (known.find(x) == known.end()) { + trace(9992, "transform") << x.name << " => " << names_to_string(x.type) << end(); + known.insert(x); + } + if (!types_strictly_match(known.find(x)->type, x.type)) { + raise << maybe(caller.name) << "'" << x.name << "' used with multiple types\n" << end(); + return; + } + if (is_mu_array(x)) { + if (!x.type->right) { + raise << maybe(caller.name) << "'" << x.name << ": can't be just an array. What is it an array of?\n" << end(); + return; + } + if (!x.type->right->right) { + raise << caller.name << " can't determine the size of array variable '" << x.name << "'. Either allocate it separately and make the type of '" << x.name << "' an address, or specify the length of the array in the type of '" << x.name << "'.\n" << end(); + return; + } + } +} + +:(scenario transform_fills_in_missing_types) +def main [ + x:num <- copy 1 + y:num <- add x, 1 +] +# x is in location 1, y in location 2 ++mem: storing 2 in location 2 + +:(scenario transform_fills_in_missing_types_in_product) +def main [ + x:num <- copy 1 + x <- copy 2 +] +# x is in location 1 ++mem: storing 2 in location 1 + +:(scenario transform_fills_in_missing_types_in_product_and_ingredient) +def main [ + x:num <- copy 1 + x <- add x, 1 +] +# x is in location 1 ++mem: storing 2 in location 1 + +:(scenario transform_fills_in_missing_label_type) +def main [ + jump +target + 1:num <- copy 0 + +target +] +-mem: storing 0 in location 1 + +:(scenario transform_fails_on_missing_types_in_first_mention) +% Hide_errors = true; +def main [ + x <- copy 1 + x:num <- copy 2 +] ++error: main: missing type for 'x' in 'x <- copy 1' + +:(scenario transform_fails_on_wrong_type_for_label) +% Hide_errors = true; +def main [ + +foo:num <- copy 34 +] ++error: main: non-label '+foo' must begin with a letter + +:(scenario typo_in_address_type_fails) +% Hide_errors = true; +def main [ + y:&:charcter <- new character:type + *y <- copy 67 +] ++error: main: unknown type charcter in 'y:&:charcter <- new character:type' + +:(scenario array_type_without_size_fails) +% Hide_errors = true; +def main [ + x:@:num <- merge 2, 12, 13 +] ++error: main can't determine the size of array variable 'x'. Either allocate it separately and make the type of 'x' an address, or specify the length of the array in the type of 'x'. + +:(scenarios transform) +:(scenario transform_checks_types_of_identical_reagents_in_multiple_spaces) +def foo [ # dummy +] +def main [ + local-scope + 0:space/names:foo <- copy 0 # specify surrounding space + x:bool <- copy 1/true + x:num/space:1 <- copy 34 + x/space:1 <- copy 35 +] +$error: 0 + +:(scenario transform_handles_empty_reagents) +% Hide_errors = true; +def main [ + add * +] ++error: illegal name '*' +# no crash diff --git a/047check_type_by_name.cc b/047check_type_by_name.cc deleted file mode 100644 index 83b80571..00000000 --- a/047check_type_by_name.cc +++ /dev/null @@ -1,159 +0,0 @@ -//: Some simple sanity checks for types, and also attempts to guess them where -//: they aren't provided. -//: -//: You still have to provide the full type the first time you mention a -//: variable in a recipe. You have to explicitly name :offset and :variant -//: every single time. You can't use the same name with multiple types in a -//: single recipe. - -:(scenario transform_fails_on_reusing_name_with_different_type) -% Hide_errors = true; -def main [ - x:num <- copy 1 - x:bool <- copy 1 -] -+error: main: 'x' used with multiple types - -:(after "Transform.push_back(expand_type_abbreviations)") -Transform.push_back(check_or_set_types_by_name); // idempotent - -:(code) -void check_or_set_types_by_name(const recipe_ordinal r) { - trace(9991, "transform") << "--- deduce types for recipe " << get(Recipe, r).name << end(); - recipe& caller = get(Recipe, r); - set known; - for (int i = 0; i < SIZE(caller.steps); ++i) { - instruction& inst = caller.steps.at(i); - for (int in = 0; in < SIZE(inst.ingredients); ++in) { - deduce_missing_type(known, inst.ingredients.at(in)); - check_type(known, inst.ingredients.at(in), caller); - } - for (int out = 0; out < SIZE(inst.products); ++out) { - deduce_missing_type(known, inst.products.at(out)); - check_type(known, inst.products.at(out), caller); - } - } -} - -void deduce_missing_type(set& known, reagent& x) { - if (x.type) return; - if (is_jump_target(x.name)) { - x.type = new type_tree("label"); - return; - } - if (known.find(x) == known.end()) return; - x.type = new type_tree(*known.find(x)->type); - trace(9992, "transform") << x.name << " <= " << names_to_string(x.type) << end(); -} - -void check_type(set& known, const reagent& x, const recipe& caller) { - if (is_literal(x)) return; - if (is_integer(x.name)) return; // if you use raw locations you're probably doing something unsafe - if (!x.type) return; // might get filled in by other logic later - if (is_jump_target(x.name)) { - if (!x.type->atom || x.type->name != "label") - raise << maybe(caller.name) << "non-label '" << x.name << "' must begin with a letter\n" << end(); - return; - } - if (known.find(x) == known.end()) { - trace(9992, "transform") << x.name << " => " << names_to_string(x.type) << end(); - known.insert(x); - } - if (!types_strictly_match(known.find(x)->type, x.type)) { - raise << maybe(caller.name) << "'" << x.name << "' used with multiple types\n" << end(); - return; - } - if (is_mu_array(x)) { - if (!x.type->right) { - raise << maybe(caller.name) << "'" << x.name << ": can't be just an array. What is it an array of?\n" << end(); - return; - } - if (!x.type->right->right) { - raise << caller.name << " can't determine the size of array variable '" << x.name << "'. Either allocate it separately and make the type of '" << x.name << "' an address, or specify the length of the array in the type of '" << x.name << "'.\n" << end(); - return; - } - } -} - -:(scenario transform_fills_in_missing_types) -def main [ - x:num <- copy 1 - y:num <- add x, 1 -] -# x is in location 1, y in location 2 -+mem: storing 2 in location 2 - -:(scenario transform_fills_in_missing_types_in_product) -def main [ - x:num <- copy 1 - x <- copy 2 -] -# x is in location 1 -+mem: storing 2 in location 1 - -:(scenario transform_fills_in_missing_types_in_product_and_ingredient) -def main [ - x:num <- copy 1 - x <- add x, 1 -] -# x is in location 1 -+mem: storing 2 in location 1 - -:(scenario transform_fills_in_missing_label_type) -def main [ - jump +target - 1:num <- copy 0 - +target -] --mem: storing 0 in location 1 - -:(scenario transform_fails_on_missing_types_in_first_mention) -% Hide_errors = true; -def main [ - x <- copy 1 - x:num <- copy 2 -] -+error: main: missing type for 'x' in 'x <- copy 1' - -:(scenario transform_fails_on_wrong_type_for_label) -% Hide_errors = true; -def main [ - +foo:num <- copy 34 -] -+error: main: non-label '+foo' must begin with a letter - -:(scenario typo_in_address_type_fails) -% Hide_errors = true; -def main [ - y:&:charcter <- new character:type - *y <- copy 67 -] -+error: main: unknown type charcter in 'y:&:charcter <- new character:type' - -:(scenario array_type_without_size_fails) -% Hide_errors = true; -def main [ - x:@:num <- merge 2, 12, 13 -] -+error: main can't determine the size of array variable 'x'. Either allocate it separately and make the type of 'x' an address, or specify the length of the array in the type of 'x'. - -:(scenarios transform) -:(scenario transform_checks_types_of_identical_reagents_in_multiple_spaces) -def foo [ # dummy -] -def main [ - local-scope - 0:space/names:foo <- copy 0 # specify surrounding space - x:bool <- copy 1/true - x:num/space:1 <- copy 34 - x/space:1 <- copy 35 -] -$error: 0 - -:(scenario transform_handles_empty_reagents) -% Hide_errors = true; -def main [ - add * -] -+error: illegal name '*' -# no crash diff --git a/html/046check_type_by_name.cc.html b/html/046check_type_by_name.cc.html new file mode 100644 index 00000000..73e689cf --- /dev/null +++ b/html/046check_type_by_name.cc.html @@ -0,0 +1,227 @@ + + + + +Mu - 046check_type_by_name.cc + + + + + + + + + + +
+  1 //: Some simple sanity checks for types, and also attempts to guess them where
+  2 //: they aren't provided.
+  3 //:
+  4 //: You still have to provide the full type the first time you mention a
+  5 //: variable in a recipe. You have to explicitly name :offset and :variant
+  6 //: every single time. You can't use the same name with multiple types in a
+  7 //: single recipe.
+  8 
+  9 :(scenario transform_fails_on_reusing_name_with_different_type)
+ 10 % Hide_errors = true;
+ 11 def main [
+ 12   x:num <- copy 1
+ 13   x:bool <- copy 1
+ 14 ]
+ 15 +error: main: 'x' used with multiple types
+ 16 
+ 17 :(after "Transform.push_back(expand_type_abbreviations)")
+ 18 Transform.push_back(check_or_set_types_by_name);  // idempotent
+ 19 
+ 20 :(code)
+ 21 void check_or_set_types_by_name(const recipe_ordinal r) {
+ 22   trace(9991, "transform") << "--- deduce types for recipe " << get(Recipe, r).name << end();
+ 23   recipe& caller = get(Recipe, r);
+ 24   set<reagent> known;
+ 25   for (int i = 0;  i < SIZE(caller.steps);  ++i) {
+ 26   ¦ instruction& inst = caller.steps.at(i);
+ 27   ¦ for (int in = 0;  in < SIZE(inst.ingredients);  ++in) {
+ 28   ¦ ¦ deduce_missing_type(known, inst.ingredients.at(in));
+ 29   ¦ ¦ check_type(known, inst.ingredients.at(in), caller);
+ 30   ¦ }
+ 31   ¦ for (int out = 0;  out < SIZE(inst.products);  ++out) {
+ 32   ¦ ¦ deduce_missing_type(known, inst.products.at(out));
+ 33   ¦ ¦ check_type(known, inst.products.at(out), caller);
+ 34   ¦ }
+ 35   }
+ 36 }
+ 37 
+ 38 void deduce_missing_type(set<reagent>& known, reagent& x) {
+ 39   if (x.type) return;
+ 40   if (is_jump_target(x.name)) {
+ 41   ¦ x.type = new type_tree("label");
+ 42   ¦ return;
+ 43   }
+ 44   if (known.find(x) == known.end()) return;
+ 45   x.type = new type_tree(*known.find(x)->type);
+ 46   trace(9992, "transform") << x.name << " <= " << names_to_string(x.type) << end();
+ 47 }
+ 48 
+ 49 void check_type(set<reagent>& known, const reagent& x, const recipe& caller) {
+ 50   if (is_literal(x)) return;
+ 51   if (is_integer(x.name)) return;  // if you use raw locations you're probably doing something unsafe
+ 52   if (!x.type) return;  // might get filled in by other logic later
+ 53   if (is_jump_target(x.name)) {
+ 54   ¦ if (!x.type->atom || x.type->name != "label")
+ 55   ¦ ¦ raise << maybe(caller.name) << "non-label '" << x.name << "' must begin with a letter\n" << end();
+ 56   ¦ return;
+ 57   }
+ 58   if (known.find(x) == known.end()) {
+ 59   ¦ trace(9992, "transform") << x.name << " => " << names_to_string(x.type) << end();
+ 60   ¦ known.insert(x);
+ 61   }
+ 62   if (!types_strictly_match(known.find(x)->type, x.type)) {
+ 63   ¦ raise << maybe(caller.name) << "'" << x.name << "' used with multiple types\n" << end();
+ 64   ¦ return;
+ 65   }
+ 66   if (is_mu_array(x)) {
+ 67   ¦ if (!x.type->right) {
+ 68   ¦ ¦ raise << maybe(caller.name) << "'" << x.name << ": can't be just an array. What is it an array of?\n" << end();
+ 69   ¦ ¦ return;
+ 70   ¦ }
+ 71   ¦ if (!x.type->right->right) {
+ 72   ¦ ¦ raise << caller.name << " can't determine the size of array variable '" << x.name << "'. Either allocate it separately and make the type of '" << x.name << "' an address, or specify the length of the array in the type of '" << x.name << "'.\n" << end();
+ 73   ¦ ¦ return;
+ 74   ¦ }
+ 75   }
+ 76 }
+ 77 
+ 78 :(scenario transform_fills_in_missing_types)
+ 79 def main [
+ 80   x:num <- copy 1
+ 81   y:num <- add x, 1
+ 82 ]
+ 83 # x is in location 1, y in location 2
+ 84 +mem: storing 2 in location 2
+ 85 
+ 86 :(scenario transform_fills_in_missing_types_in_product)
+ 87 def main [
+ 88   x:num <- copy 1
+ 89   x <- copy 2
+ 90 ]
+ 91 # x is in location 1
+ 92 +mem: storing 2 in location 1
+ 93 
+ 94 :(scenario transform_fills_in_missing_types_in_product_and_ingredient)
+ 95 def main [
+ 96   x:num <- copy 1
+ 97   x <- add x, 1
+ 98 ]
+ 99 # x is in location 1
+100 +mem: storing 2 in location 1
+101 
+102 :(scenario transform_fills_in_missing_label_type)
+103 def main [
+104   jump +target
+105   1:num <- copy 0
+106   +target
+107 ]
+108 -mem: storing 0 in location 1
+109 
+110 :(scenario transform_fails_on_missing_types_in_first_mention)
+111 % Hide_errors = true;
+112 def main [
+113   x <- copy 1
+114   x:num <- copy 2
+115 ]
+116 +error: main: missing type for 'x' in 'x <- copy 1'
+117 
+118 :(scenario transform_fails_on_wrong_type_for_label)
+119 % Hide_errors = true;
+120 def main [
+121   +foo:num <- copy 34
+122 ]
+123 +error: main: non-label '+foo' must begin with a letter
+124 
+125 :(scenario typo_in_address_type_fails)
+126 % Hide_errors = true;
+127 def main [
+128   y:&:charcter <- new character:type
+129   *y <- copy 67
+130 ]
+131 +error: main: unknown type charcter in 'y:&:charcter <- new character:type'
+132 
+133 :(scenario array_type_without_size_fails)
+134 % Hide_errors = true;
+135 def main [
+136   x:@:num <- merge 2, 12, 13
+137 ]
+138 +error: main can't determine the size of array variable 'x'. Either allocate it separately and make the type of 'x' an address, or specify the length of the array in the type of 'x'.
+139 
+140 :(scenarios transform)
+141 :(scenario transform_checks_types_of_identical_reagents_in_multiple_spaces)
+142 def foo [  # dummy
+143 ]
+144 def main [
+145   local-scope
+146   0:space/names:foo <- copy 0  # specify surrounding space
+147   x:bool <- copy 1/true
+148   x:num/space:1 <- copy 34
+149   x/space:1 <- copy 35
+150 ]
+151 $error: 0
+152 
+153 :(scenario transform_handles_empty_reagents)
+154 % Hide_errors = true;
+155 def main [
+156   add *
+157 ]
+158 +error: illegal name '*'
+159 # no crash
+
+ + + diff --git a/html/047check_type_by_name.cc.html b/html/047check_type_by_name.cc.html deleted file mode 100644 index 8cfd791a..00000000 --- a/html/047check_type_by_name.cc.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - -Mu - 047check_type_by_name.cc - - - - - - - - - - -
-  1 //: Some simple sanity checks for types, and also attempts to guess them where
-  2 //: they aren't provided.
-  3 //:
-  4 //: You still have to provide the full type the first time you mention a
-  5 //: variable in a recipe. You have to explicitly name :offset and :variant
-  6 //: every single time. You can't use the same name with multiple types in a
-  7 //: single recipe.
-  8 
-  9 :(scenario transform_fails_on_reusing_name_with_different_type)
- 10 % Hide_errors = true;
- 11 def main [
- 12   x:num <- copy 1
- 13   x:bool <- copy 1
- 14 ]
- 15 +error: main: 'x' used with multiple types
- 16 
- 17 :(after "Transform.push_back(expand_type_abbreviations)")
- 18 Transform.push_back(check_or_set_types_by_name);  // idempotent
- 19 
- 20 :(code)
- 21 void check_or_set_types_by_name(const recipe_ordinal r) {
- 22   trace(9991, "transform") << "--- deduce types for recipe " << get(Recipe, r).name << end();
- 23   recipe& caller = get(Recipe, r);
- 24   set<reagent> known;
- 25   for (int i = 0;  i < SIZE(caller.steps);  ++i) {
- 26   ¦ instruction& inst = caller.steps.at(i);
- 27   ¦ for (int in = 0;  in < SIZE(inst.ingredients);  ++in) {
- 28   ¦ ¦ deduce_missing_type(known, inst.ingredients.at(in));
- 29   ¦ ¦ check_type(known, inst.ingredients.at(in), caller);
- 30   ¦ }
- 31   ¦ for (int out = 0;  out < SIZE(inst.products);  ++out) {
- 32   ¦ ¦ deduce_missing_type(known, inst.products.at(out));
- 33   ¦ ¦ check_type(known, inst.products.at(out), caller);
- 34   ¦ }
- 35   }
- 36 }
- 37 
- 38 void deduce_missing_type(set<reagent>& known, reagent& x) {
- 39   if (x.type) return;
- 40   if (is_jump_target(x.name)) {
- 41   ¦ x.type = new type_tree("label");
- 42   ¦ return;
- 43   }
- 44   if (known.find(x) == known.end()) return;
- 45   x.type = new type_tree(*known.find(x)->type);
- 46   trace(9992, "transform") << x.name << " <= " << names_to_string(x.type) << end();
- 47 }
- 48 
- 49 void check_type(set<reagent>& known, const reagent& x, const recipe& caller) {
- 50   if (is_literal(x)) return;
- 51   if (is_integer(x.name)) return;  // if you use raw locations you're probably doing something unsafe
- 52   if (!x.type) return;  // might get filled in by other logic later
- 53   if (is_jump_target(x.name)) {
- 54   ¦ if (!x.type->atom || x.type->name != "label")
- 55   ¦ ¦ raise << maybe(caller.name) << "non-label '" << x.name << "' must begin with a letter\n" << end();
- 56   ¦ return;
- 57   }
- 58   if (known.find(x) == known.end()) {
- 59   ¦ trace(9992, "transform") << x.name << " => " << names_to_string(x.type) << end();
- 60   ¦ known.insert(x);
- 61   }
- 62   if (!types_strictly_match(known.find(x)->type, x.type)) {
- 63   ¦ raise << maybe(caller.name) << "'" << x.name << "' used with multiple types\n" << end();
- 64   ¦ return;
- 65   }
- 66   if (is_mu_array(x)) {
- 67   ¦ if (!x.type->right) {
- 68   ¦ ¦ raise << maybe(caller.name) << "'" << x.name << ": can't be just an array. What is it an array of?\n" << end();
- 69   ¦ ¦ return;
- 70   ¦ }
- 71   ¦ if (!x.type->right->right) {
- 72   ¦ ¦ raise << caller.name << " can't determine the size of array variable '" << x.name << "'. Either allocate it separately and make the type of '" << x.name << "' an address, or specify the length of the array in the type of '" << x.name << "'.\n" << end();
- 73   ¦ ¦ return;
- 74   ¦ }
- 75   }
- 76 }
- 77 
- 78 :(scenario transform_fills_in_missing_types)
- 79 def main [
- 80   x:num <- copy 1
- 81   y:num <- add x, 1
- 82 ]
- 83 # x is in location 1, y in location 2
- 84 +mem: storing 2 in location 2
- 85 
- 86 :(scenario transform_fills_in_missing_types_in_product)
- 87 def main [
- 88   x:num <- copy 1
- 89   x <- copy 2
- 90 ]
- 91 # x is in location 1
- 92 +mem: storing 2 in location 1
- 93 
- 94 :(scenario transform_fills_in_missing_types_in_product_and_ingredient)
- 95 def main [
- 96   x:num <- copy 1
- 97   x <- add x, 1
- 98 ]
- 99 # x is in location 1
-100 +mem: storing 2 in location 1
-101 
-102 :(scenario transform_fills_in_missing_label_type)
-103 def main [
-104   jump +target
-105   1:num <- copy 0
-106   +target
-107 ]
-108 -mem: storing 0 in location 1
-109 
-110 :(scenario transform_fails_on_missing_types_in_first_mention)
-111 % Hide_errors = true;
-112 def main [
-113   x <- copy 1
-114   x:num <- copy 2
-115 ]
-116 +error: main: missing type for 'x' in 'x <- copy 1'
-117 
-118 :(scenario transform_fails_on_wrong_type_for_label)
-119 % Hide_errors = true;
-120 def main [
-121   +foo:num <- copy 34
-122 ]
-123 +error: main: non-label '+foo' must begin with a letter
-124 
-125 :(scenario typo_in_address_type_fails)
-126 % Hide_errors = true;
-127 def main [
-128   y:&:charcter <- new character:type
-129   *y <- copy 67
-130 ]
-131 +error: main: unknown type charcter in 'y:&:charcter <- new character:type'
-132 
-133 :(scenario array_type_without_size_fails)
-134 % Hide_errors = true;
-135 def main [
-136   x:@:num <- merge 2, 12, 13
-137 ]
-138 +error: main can't determine the size of array variable 'x'. Either allocate it separately and make the type of 'x' an address, or specify the length of the array in the type of 'x'.
-139 
-140 :(scenarios transform)
-141 :(scenario transform_checks_types_of_identical_reagents_in_multiple_spaces)
-142 def foo [  # dummy
-143 ]
-144 def main [
-145   local-scope
-146   0:space/names:foo <- copy 0  # specify surrounding space
-147   x:bool <- copy 1/true
-148   x:num/space:1 <- copy 34
-149   x/space:1 <- copy 35
-150 ]
-151 $error: 0
-152 
-153 :(scenario transform_handles_empty_reagents)
-154 % Hide_errors = true;
-155 def main [
-156   add *
-157 ]
-158 +error: illegal name '*'
-159 # no crash
-
- - - diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index 4401c68c..9717d92c 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -476,7 +476,7 @@ if ('onhashchange' in window) { 409 ¦ ¦ return; 410 ¦ } 411 ¦ if (!is_integer(lhs)) { -412 ¦ ¦ check_type(lhs, in); +412 ¦ ¦ check_type(lhs, in); 413 ¦ ¦ continue; 414 ¦ } 415 ¦ int address = to_integer(lhs); @@ -509,7 +509,7 @@ if ('onhashchange' in window) { 442 } 443 } 444 -445 void check_type(const string& lhs, istream& in) { +445 void check_type(const string& lhs, istream& in) { 446 reagent x(lhs); 447 if (is_mu_array(x.type) && is_mu_character(array_element(x.type))) { 448 ¦ x.set_value(to_integer(x.name)); -- cgit 1.4.1-2-gfad0