diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-04-23 17:02:16 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-04-23 17:15:16 -0700 |
commit | 7bf9212fd47e505711cc0873d30456e3d793034d (patch) | |
tree | e6c84ac4666269b5e366ceff78dd040ac39343bc /031container.cc | |
parent | 991d76f32817f5515fb8db25a7d5ca2912cfe4ac (diff) | |
download | mu-7bf9212fd47e505711cc0873d30456e3d793034d.tar.gz |
2861 - 'maybe-convert' no longer returns address
Diffstat (limited to '031container.cc')
-rw-r--r-- | 031container.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/031container.cc b/031container.cc index 14a90501..32b38bc7 100644 --- a/031container.cc +++ b/031container.cc @@ -660,6 +660,14 @@ def main [ ] +error: main: too few ingredients in '1:point-number <- merge 3, 4' +:(scenario merge_check_reflexive) +% Hide_errors = true; +def main [ + 1:point <- merge 3, 4 + 2:point <- merge 1:point +] +$error: 0 + //: Since a container can be merged in several ways, we need to be able to //: backtrack through different possibilities. Later we'll allow creating //: exclusive containers which contain just one of rather than all of their @@ -721,6 +729,9 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product type_info& container_info = get(Type, container.type->value); switch (container_info.kind) { case CONTAINER: { + // degenerate case: merge with the same type always succeeds + if (state.data.top().container_element_index == 0 && types_coercible(container, inst.ingredients.at(ingredient_index))) + return; reagent expected_ingredient = element_type(container, state.data.top().container_element_index); trace(9999, "transform") << "checking container " << to_string(container) << " || " << to_string(expected_ingredient) << " vs ingredient " << ingredient_index << end(); // if the current element is the ingredient we expect, move on to the next element/ingredient |