Skip to content

Commit

Permalink
Fix for Jira bug I7-2366
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Jul 5, 2023
1 parent 7da48d3 commit ad2c648
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/WorldModelKit/S-tm.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">scene_endings</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">sc</span><span class="plain-syntax">-1) &lt;= </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">RunTimeProblem</span><span class="plain-syntax">(</span><span class="identifier-syntax">RTP_SCENEHASNTENDED</span><span class="plain-syntax">, </span><span class="identifier-syntax">sc</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">task</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">the_time</span><span class="plain-syntax"> - </span><span class="identifier-syntax">scene_started</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">sc</span><span class="plain-syntax">-1))%(</span><span class="identifier-syntax">TWENTY_FOUR_HOURS</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TWENTY_FOUR_HOURS</span><span class="plain-syntax"> + </span><span class="identifier-syntax">the_time</span><span class="plain-syntax"> - </span><span class="identifier-syntax">scene_started</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">sc</span><span class="plain-syntax">-1))%(</span><span class="identifier-syntax">TWENTY_FOUR_HOURS</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">scene_started</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">sc</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">the_time</span><span class="plain-syntax"> - </span><span class="identifier-syntax">scene_ended</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">sc</span><span class="plain-syntax">-1))%(</span><span class="identifier-syntax">TWENTY_FOUR_HOURS</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TWENTY_FOUR_HOURS</span><span class="plain-syntax"> + </span><span class="identifier-syntax">the_time</span><span class="plain-syntax"> - </span><span class="identifier-syntax">scene_ended</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">sc</span><span class="plain-syntax">-1))%(</span><span class="identifier-syntax">TWENTY_FOUR_HOURS</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="constant-syntax">4</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">scene_ended</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">sc</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax">];</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/building-module/3-prd.html
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ <h1><a href="../index.html">

<span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">Produce::kind_to_symbol</span><button class="popup" onclick="togglePopup('usagePopup35')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup35">Usage of <span class="code-font"><span class="function-syntax">Produce::kind_to_symbol</span></span>:<br/><a href="3-prd.html#SP32">&#167;32</a>, <a href="3-prd.html#SP34">&#167;34</a>, <a href="3-prd.html#SP39">&#167;39</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">K</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">K</span><span class="plain-syntax"> == </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">K</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">K</span><span class="plain-syntax"> == </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">K</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">construct</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CON_INTERMEDIATE</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="1-in.html#SP9" class="function-link"><span class="function-syntax">InterNames::to_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RTKindDeclarations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">));</span>
<span class="plain-syntax"> #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax"> #</span><span class="identifier-syntax">ifndef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
Expand Down
8 changes: 8 additions & 0 deletions docs/imperative-module/5-cii.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><span class="identifier-syntax">tokens</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_vals</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">];</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Invocations::get_token_variable_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">K</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">K</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">construct</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CON_INTERMEDIATE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_DimensionallyImpossibleLetVariable</span><span class="plain-syntax">),</span>
<span class="plain-syntax"> </span><span class="string-syntax">"this variable does not have a kind I can use"</span><span class="plain-syntax">,</span>
<span class="plain-syntax"> </span><span class="string-syntax">"since it results from performing arithmetic on other values "</span>
<span class="plain-syntax"> </span><span class="string-syntax">"in a way which doesn't result in a kind that I recognise."</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">K_number</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">local_variable</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lvar</span><span class="plain-syntax"> = </span><a href="3-lv.html#SP7" class="function-link"><span class="function-syntax">LocalVariables::new_let_value</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">), </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">IDTypeData::block_follows</span><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">LOOP_BODY_BLOCK_FOLLOWS</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><a href="3-cb.html#SP18" class="function-link"><span class="function-syntax">CodeBlocks::set_scope_to_block_about_to_open</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">lvar</span><span class="plain-syntax">);</span>
Expand Down
6 changes: 4 additions & 2 deletions docs/knowledge-module/2-ins.html
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">kc</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_constructor</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">L</span><span class="plain-syntax"> = </span><span class="identifier-syntax">KindConstructors::instances</span><span class="plain-syntax">(</span><span class="identifier-syntax">kc</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">kind_constructor_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kci</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">current_val</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">current_val</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">first_val</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">kci</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_constructor_instance</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Feeds::feed_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">kci</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">natural_language_name</span><span class="plain-syntax">);</span>
Expand All @@ -482,10 +482,12 @@ <h1><a href="../index.html">
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">current_val</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">kci</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">value</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">current_val</span><span class="plain-syntax">++;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">RTKindConstructors::set_explicit_runtime_instance_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">current_val</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">RTInstances::set_translation</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">kci</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">identifier</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="comment-syntax"> LOG("From kit: %W = %S = %d -&gt; $O\n", W, kci-&gt;identifier, current_val, I);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">current_val</span><span class="plain-syntax">++;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">first_val</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> }</span>
Expand Down
25 changes: 12 additions & 13 deletions inform7/Figures/timings-diagnostics.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
100.0% in inform7 run
68.1% in compilation to Inter
46.2% in //Sequence::undertake_queued_tasks//
4.9% in //MajorNodes::pre_pass//
3.7% in //MajorNodes::pass_1//
1.8% in //ImperativeDefinitions::assess_all//
68.0% in compilation to Inter
45.3% in //Sequence::undertake_queued_tasks//
5.0% in //MajorNodes::pre_pass//
3.4% in //MajorNodes::pass_1//
1.5% in //ImperativeDefinitions::assess_all//
1.5% in //RTKindConstructors::compile//
1.5% in //RTPhrasebook::compile_entries//
1.1% in //Sequence::lint_inter//
Expand All @@ -14,16 +14,15 @@
0.3% in //Sequence::undertake_queued_tasks//
0.3% in //Sequence::undertake_queued_tasks//
0.3% in //World::stage_V//
4.5% not specifically accounted for
27.6% in running Inter pipeline
9.4% in step 14/15: generate inform6 -> auto.inf
7.1% in step 5/15: load-binary-kits
5.6% in step 6/15: make-synoptic-module
1.8% in step 9/15: make-identifiers-unique
5.7% not specifically accounted for
28.0% in running Inter pipeline
9.6% in step 14/15: generate inform6 -> auto.inf
7.3% in step 5/15: load-binary-kits
5.7% in step 6/15: make-synoptic-module
1.9% in step 9/15: make-identifiers-unique
0.3% in step 12/15: eliminate-redundant-operations
0.3% in step 4/15: compile-splats
0.3% in step 7/15: shorten-wiring
0.3% in step 8/15: detect-indirect-calls
1.9% not specifically accounted for
3.7% in supervisor
0.4% not specifically accounted for
3.8% in supervisor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Lab is a room.
when play begins:
let x be 5 minutes;
let y be x * x;

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Inform 7 v10.2.0 has started.
I've now read your source text, which is 18 words long.
I've also read version 2 of Basic Inform by Graham Nelson, which is 8315 words long.
I've also read version 2 of English Language by Graham Nelson, which is 2330 words long.
I've also read version 7 of Standard Rules by Graham Nelson, which is 34949 words long.
Problem__ PM_DimensionallyImpossibleLetVariable
>--> You wrote 'let y be x * x' (source text, line 4): but this variable does
not have a kind I can use, since it results from performing arithmetic on
other values in a way which doesn't result in a kind that I recognise.
Inform 7 has finished.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ this issue.
parse_node *val = tokens->token_vals[i];
kind *K = Invocations::get_token_variable_kind(inv, i);
if (K) {
if (K->construct == CON_INTERMEDIATE) {
StandardProblems::sentence_problem(Task::syntax_tree(),
_p_(PM_DimensionallyImpossibleLetVariable),
"this variable does not have a kind I can use",
"since it results from performing arithmetic on other values "
"in a way which doesn't result in a kind that I recognise.");
K = K_number;
}
local_variable *lvar = LocalVariables::new_let_value(Node::get_text(val), K);
if (IDTypeData::block_follows(idb) == LOOP_BODY_BLOCK_FOLLOWS)
CodeBlocks::set_scope_to_block_about_to_open(lvar);
Expand Down
2 changes: 1 addition & 1 deletion inter/building-module/Chapter 3/Produce.w
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ void Produce::cast(inter_tree *I, kind *F, kind *T) {

inter_symbol *Produce::kind_to_symbol(kind *K) {
#ifdef CORE_MODULE
if ((K == NULL) || (K == K_value)) return NULL;
if ((K == NULL) || (K == K_value) || (K->construct == CON_INTERMEDIATE)) return NULL;
return InterNames::to_symbol(RTKindDeclarations::iname(K));
#endif
#ifndef CORE_MODULE
Expand Down
Loading

0 comments on commit ad2c648

Please sign in to comment.