diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-07-20 18:05:56 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-07-20 18:05:56 -0700 |
commit | e81da299fb49bd79cd460d477ec0bb673035620a (patch) | |
tree | e4b162be797dcb6d2793a5f7831c6c39bd099a85 /html/032array.cc.html | |
parent | edfc4cf8ac21a30307cd36bb9cff6a4a8b92dee7 (diff) | |
download | mu-e81da299fb49bd79cd460d477ec0bb673035620a.tar.gz |
3117
Diffstat (limited to 'html/032array.cc.html')
-rw-r--r-- | html/032array.cc.html | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/html/032array.cc.html b/html/032array.cc.html index fb9bb0d5..c432da93 100644 --- a/html/032array.cc.html +++ b/html/032array.cc.html @@ -147,7 +147,7 @@ def main [ <span class="Comment">//: arrays are disallowed inside containers unless their length is fixed in</span> <span class="Comment">//: advance</span> -<span class="Delimiter">:(scenario container_contains_array)</span> +<span class="Delimiter">:(scenario container_permits_static_array_element)</span> container foo [ <span class="Normal">x</span>:array:number:<span class="Constant">3</span> ] @@ -160,6 +160,25 @@ container foo [ ] <span class="traceContains">+error: container 'foo' cannot determine size of element 'x'</span> +<span class="Comment">//: disable the size mismatch check for 'merge' instructions since containers</span> +<span class="Comment">//: can contain arrays, and since we already do plenty of checking for them</span> +<span class="Delimiter">:(before "End size_mismatch(x) Cases")</span> +<span class="Normal">if</span> <span class="Delimiter">(</span>current_call<span class="Delimiter">().</span>running_step_index < SIZE<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> current_call<span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">)</span> + && current_instruction<span class="Delimiter">().</span>operation == MERGE<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + +<span class="Delimiter">:(scenario merge_static_array_into_container)</span> +container foo [ + <span class="Normal">x</span>:number + <span class="Normal">y</span>:array:number:<span class="Constant">3</span> +] +def main [ + <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">10</span>:foo<span class="Special"> <- </span>merge <span class="Constant">34</span><span class="Delimiter">,</span> <span class="Constant">1</span>:array:number:<span class="Constant">3</span> +] +<span class="Comment"># no errors</span> + <span class="Delimiter">:(before "End Load Container Element Definition")</span> <span class="Delimiter">{</span> <span class="Normal">const</span> type_tree* type = info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>type<span class="Delimiter">;</span> |