1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-01 06:24:58 +03:00

Fix for Jira bug I7-2185

This commit is contained in:
Graham Nelson 2022-08-28 13:28:03 +01:00
parent 894dcc044d
commit 2173d4b863
5 changed files with 55 additions and 12 deletions

View file

@ -86,6 +86,7 @@ either as an object, a value or a subtree — should have
<span class="plain-syntax"> </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val_subtree</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">pcalc_prop</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><a href="8-cu.html#SP7" class="function-link"><span class="function-syntax">Propositions::Abstract::from_property_subtree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">val_subtree</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">owner</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-pk.html#SP2_3" class="named-paragraph-link"><span class="named-paragraph">Issue a problem for an unrecognised property owner</span><span class="named-paragraph-number">2.3</span></a></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">prevailing_mood</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-pk.html#SP2_4" class="named-paragraph-link"><span class="named-paragraph">Issue a problem for a negative certainty</span><span class="named-paragraph-number">2.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Assert::true_about</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">prevailing_mood</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
@ -172,6 +173,21 @@ are typechecked at run-time rather than compile-time in that domain.)
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pk.html#SP2">&#167;2</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP2_4" class="paragraph-anchor"></a><b>&#167;2.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue a problem for a negative certainty</span><span class="named-paragraph-number">2.4</span></span><span class="comment-syntax"> =</span>
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PropWithNegativeCertainty</span><span class="plain-syntax">));</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax"> </span><span class="string-syntax">"The sentence %1 looked to me as if it might be trying to say what a "</span>
<span class="plain-syntax"> </span><span class="string-syntax">"property value is not, rather than what it is, by using 'never', or "</span>
<span class="plain-syntax"> </span><span class="string-syntax">"'seldom'. You can only say what it is, or for properties of kinds, what "</span>
<span class="plain-syntax"> </span><span class="string-syntax">"it 'usually' is."</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pk.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>The following assumes that the subtree <span class="extract"><span class="extract-syntax">py</span></span> describes a value which the
<span class="extract"><span class="extract-syntax">prn</span></span> property of something will have; it issues problem messages if this
would be impossible, returning <span class="extract"><span class="extract-syntax">NULL</span></span>, or else silently returns the value.

View file

@ -1,32 +1,33 @@
100.0% in inform7 run
70.5% in compilation to Inter
50.2% in //Sequence::undertake_queued_tasks//
4.7% in //MajorNodes::pre_pass//
3.4% in //MajorNodes::pass_1//
71.2% in compilation to Inter
50.9% in //Sequence::undertake_queued_tasks//
4.6% in //MajorNodes::pre_pass//
3.5% in //MajorNodes::pass_1//
1.9% in //ImperativeDefinitions::assess_all//
1.4% in //RTKindConstructors::compile//
1.4% in //RTPhrasebook::compile_entries//
1.0% in //Sequence::lint_inter//
0.6% in //MajorNodes::pass_2//
0.6% in //World::stage_V//
0.4% in //ImperativeDefinitions::compile_first_block//
0.4% in //MajorNodes::pass_2//
0.4% in //Sequence::undertake_queued_tasks//
0.4% in //Sequence::undertake_queued_tasks//
0.4% in //World::stage_V//
0.2% in //CompletionModule::compile//
0.2% in //InferenceSubjects::emit_all//
0.2% in //RTKindConstructors::compile_permissions//
0.2% in //Task::make_built_in_kind_constructors//
3.2% not specifically accounted for
26.2% in running Inter pipeline
10.2% in step 14/15: generate inform6 -> auto.inf
0.2% in //World::stages_II_and_III//
2.5% not specifically accounted for
25.7% in running Inter pipeline
10.1% in step 14/15: generate inform6 -> auto.inf
5.7% in step 5/15: load-binary-kits
5.5% in step 6/15: make-synoptic-module
5.4% in step 6/15: make-synoptic-module
1.4% in step 9/15: make-identifiers-unique
0.4% in step 12/15: eliminate-redundant-operations
0.4% in step 4/15: compile-splats
0.4% in step 7/15: shorten-wiring
0.2% in step 11/15: eliminate-redundant-labels
0.2% in step 8/15: detect-indirect-calls
1.5% not specifically accounted for
1.2% not specifically accounted for
2.5% in supervisor
0.7% not specifically accounted for
0.5% not specifically accounted for

View file

@ -0,0 +1,3 @@
The lab is a room.
The lab has a number called the bar. The bar of the lab is never 42.

View file

@ -0,0 +1,11 @@
Inform 7 v10.2.0 has started.
I've now read your source text, which is 21 words long.
I've also read Basic Inform by Graham Nelson, which is 7691 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32164 words long.
Problem__ PM_PropWithNegativeCertainty
>--> The sentence 'The bar of the lab is never 42' (source text, line 3)
looked to me as if it might be trying to say what a property value is not,
rather than what it is, by using 'never', or 'seldom'. You can only say
what it is, or for properties of kinds, what it 'usually' is.
Inform 7 has finished.

View file

@ -28,6 +28,7 @@ void Assertions::PropertyKnowledge::assert_property_value_from_property_subtree_
inference_subject *owner, parse_node *val_subtree) {
pcalc_prop *prop = Propositions::Abstract::from_property_subtree(prn, val_subtree);
if (owner == NULL) @<Issue a problem for an unrecognised property owner@>;
if (prevailing_mood < UNKNOWN_CE) @<Issue a problem for a negative certainty@>;
Assert::true_about(prop, owner, prevailing_mood);
}
@ -101,6 +102,17 @@ are typechecked at run-time rather than compile-time in that domain.)
Problems::issue_problem_end();
return;
@<Issue a problem for a negative certainty@> =
Problems::quote_source(1, current_sentence);
StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_PropWithNegativeCertainty));
Problems::issue_problem_segment(
"The sentence %1 looked to me as if it might be trying to say what a "
"property value is not, rather than what it is, by using 'never', or "
"'seldom'. You can only say what it is, or for properties of kinds, what "
"it 'usually' is.");
Problems::issue_problem_end();
return;
@ The following assumes that the subtree |py| describes a value which the
|prn| property of something will have; it issues problem messages if this
would be impossible, returning |NULL|, or else silently returns the value.