diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-07-22 13:55:25 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-07-22 13:55:25 -0700 |
commit | 0c1ae52feb9ee7cc1858237d0c17da1cf863c2cc (patch) | |
tree | 63cfb6ed0ef1bf89e0f42d2f7f933e20ce9c385b | |
parent | 63f3ada69baba2cbf7a3a4cbb7e6fed847983d41 (diff) | |
download | mu-0c1ae52feb9ee7cc1858237d0c17da1cf863c2cc.tar.gz |
3123
Bugfix: permit dummy product when trying to convert exclusive containers. The 'status' product is still required, however. Without it there's no point to calling 'maybe-convert'.
-rw-r--r-- | 033exclusive_container.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/033exclusive_container.cc b/033exclusive_container.cc index 8f79e980..462521dd 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -153,11 +153,13 @@ case MAYBE_CONVERT: { const reagent& variant = variant_type(base, tag); trace(9999, "mem") << "storing 1 in location " << status.value << end(); put(Memory, status.value, 1); - // Write Memory in Successful MAYBE_CONVERT in Run - for (int i = 0; i < size_of(variant); ++i) { - double val = get_or_insert(Memory, base_address+/*skip tag*/1+i); - trace(9999, "mem") << "storing " << no_scientific(val) << " in location " << product.value+i << end(); - put(Memory, product.value+i, val); + if (!is_dummy(product)) { + // Write Memory in Successful MAYBE_CONVERT in Run + for (int i = 0; i < size_of(variant); ++i) { + double val = get_or_insert(Memory, base_address+/*skip tag*/1+i); + trace(9999, "mem") << "storing " << no_scientific(val) << " in location " << product.value+i << end(); + put(Memory, product.value+i, val); + } } } else { @@ -193,6 +195,15 @@ def main [ ] +error: main: 'maybe-convert 12:number-or-point/unsafe, 1:variant' should write to point but '20' has type number +:(scenario maybe_convert_dummy_product) +def main [ + 12:number <- copy 1 + 13:number <- copy 35 + 14:number <- copy 36 + _, 21:boolean <- maybe-convert 12:number-or-point/unsafe, 1:variant +] +$error: 0 + //:: Allow exclusive containers to be defined in mu code. :(scenario exclusive_container) |