mirror of
https://github.com/ganelson/inform.git
synced 2024-07-03 07:24:58 +03:00
Fix and test case for Mantis bug 1978
This commit is contained in:
parent
76ae1a9083
commit
06272f08e0
3
inform7/Tests/Test Problems/PM_AmbiguitiesTooDeep.txt
Normal file
3
inform7/Tests/Test Problems/PM_AmbiguitiesTooDeep.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Foo is a room.
|
||||
|
||||
When play begins: if a room encloses a room that encloses a room that encloses a room that encloses a room that encloses a room that encloses a room that encloses a room that encloses a room that encloses a room that encloses a room that encloses a room, do nothing.
|
|
@ -0,0 +1,23 @@
|
|||
Inform 7 v10.1.0 has started.
|
||||
I've now read your source text, which is 55 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 32092 words long.
|
||||
Problem__ PM_AmbiguitiesTooDeep
|
||||
>--> The phrase a room encloses a room that encloses a room that encloses a
|
||||
room that encloses a room that encloses a room that encloses a room that
|
||||
encloses a room that encloses a room that encloses a room that encloses a
|
||||
room that encloses a room is too complicated for me to disentangle without
|
||||
running very, very slowly as I check many ambiguities in it. There ought to
|
||||
be some way to simplify things for me?
|
||||
I was trying to match this phrase:
|
||||
if (a room encloses a room that encloses a room that encloses a room that
|
||||
encloses a room that encloses a room that encloses a room that encloses a
|
||||
room that encloses a room that encloses a room that encloses a room that
|
||||
encloses a room - a condition):
|
||||
I recognised:
|
||||
a room encloses a room that encloses a room that encloses a room that
|
||||
encloses a room that encloses a room that encloses a room that encloses a
|
||||
room that encloses a room that encloses a room that encloses a room that
|
||||
encloses a room = a condition
|
||||
Inform 7 has finished.
|
|
@ -828,8 +828,26 @@ later rules can override earlier ones but still make use of them.
|
|||
for (int i=0; i<no_of_possible_readings; i++)
|
||||
LOGIF(MATCHING, "Possibility (P%d) $e\n", i, list_of_possible_readings[i]);
|
||||
|
||||
@ In general, it's not great for typecheckers in compilers to put an upper bound
|
||||
on complexity, because although human-written code seldom hits such maxima, there's
|
||||
always the possibility of mechanically-generated code which does. On the other hand,
|
||||
the result of that doctrine is that a lot of modern compilers (Swift, for example)
|
||||
slow to a painful crawl and allocate gigabytes of memory trying to understand
|
||||
strange type constraints in two or three lines of code. So, for now at least,
|
||||
let's be pragmatic.
|
||||
|
||||
@<Add this reading to the list of test cases@> =
|
||||
if (no_of_possible_readings >= MAX_INVOCATIONS_PER_PHRASE) internal_error("overrun");
|
||||
if (no_of_possible_readings >= MAX_INVOCATIONS_PER_PHRASE) {
|
||||
THIS_IS_AN_ORDINARY_PROBLEM;
|
||||
Problems::quote_wording(1, Node::get_text(p));
|
||||
StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_AmbiguitiesTooDeep));
|
||||
Problems::issue_problem_segment(
|
||||
"The phrase %1 is too complicated for me to disentangle without "
|
||||
"running very, very slowly as I check many ambiguities in it. There "
|
||||
"ought to be some way to simplify things for me?");
|
||||
Problems::issue_problem_end();
|
||||
return NEVER_MATCH;
|
||||
}
|
||||
list_of_possible_readings[no_of_possible_readings++] = alt;
|
||||
Dash::clear_flags(alt);
|
||||
|
||||
|
|
Loading…
Reference in a new issue