diff options
-rw-r--r-- | 020run.cc | 4 | ||||
-rw-r--r-- | 032array.cc | 2 | ||||
-rw-r--r-- | 048typecheck.cc | 10 |
3 files changed, 14 insertions, 2 deletions
diff --git a/020run.cc b/020run.cc index 81eeb14d..be144858 100644 --- a/020run.cc +++ b/020run.cc @@ -212,7 +212,7 @@ void write_memory(reagent x, vector<double> data) { if (is_literal(x)) return; long long int base = x.value; if (size_mismatch(x, data)) { - raise << current_recipe_name() << ": size mismatch in storing to " << x.to_string() << " at " << current_instruction().to_string() << '\n' << end(); + raise << current_recipe_name() << ": size mismatch in storing to " << x.original_string << " at '" << current_instruction().to_string() << "'\n" << end(); return; } for (long long int offset = 0; offset < SIZE(data); ++offset) { @@ -234,6 +234,8 @@ long long int size_of(const vector<type_ordinal>& types) { } bool size_mismatch(const reagent& x, const vector<double>& data) { + if (x.types.empty()) return true; + // End size_mismatch(x) Cases //? if (size_of(x) != SIZE(data)) cerr << size_of(x) << " vs " << SIZE(data) << '\n'; //? 2 return size_of(x) != SIZE(data); } diff --git a/032array.cc b/032array.cc index dc8c04a5..d00f5939 100644 --- a/032array.cc +++ b/032array.cc @@ -38,7 +38,7 @@ recipe main [ +mem: storing 16 in location 9 //: disable the size mismatch check since the destination array need not be initialized -:(after "bool size_mismatch(const reagent& x, const vector<double>& data)") +:(before "End size_mismatch(x) Cases") if (x.types.at(0) == Type_ordinal["array"]) return false; :(before "End size_of(reagent) Cases") if (r.types.at(0) == Type_ordinal["array"]) { diff --git a/048typecheck.cc b/048typecheck.cc index 46225f94..f686f78f 100644 --- a/048typecheck.cc +++ b/048typecheck.cc @@ -67,3 +67,13 @@ recipe main [ x <- add x, 1 ] +mem: storing 2 in location 1 + +:(scenario transform_warns_on_missing_types_in_first_mention) +% Hide_warnings = true; +recipe main [ + x <- copy 1 + x:number <- copy 2 +] ++warn: missing type in 'x <- copy 1' ++warn: x <- copy 1: reagent not initialized: x ++warn: main: size mismatch in storing to x at 'x <- copy 1' |