curiousdannii-testing / inform7-imported-bugs

0 stars 0 forks source link

[I7-1465] [Mantis 1501] Containment of the location in a set of nested regions incorrectly evaluated. #619

Closed curiousdannii-testing closed 2 years ago

curiousdannii-testing commented 2 years ago

Reported by : Shin

Description :

When the regions are object properties, the containment of the current location in a set of nested regions is incorrectly evaluated except for the region directly enclosing the current location.

Steps to reproduce :

"New Issue" by Shin

A crowd is a kind of people. It is usually plural-named and undescribed. It has a region called territory.

Region 1 is a region. Region 2 is a region in Region 1.

A room called Room 1 is in Region 2.

Crowd 1 is here. It is a crowd. The territory of Crowd 1 is Region 2.

Crowd 2 is here. It is a crowd. The territory of Crowd 2 is Region 1.

A room called Room 2 is in Region 2 and north of Room 1.

Every turn when the location is in the territory of Crowd 1, now Crowd 1 is in the location.
Every turn when the location is in the territory of Crowd 2, now Crowd 2 is in the location.

[ Although Crowd 1 follows the player, Crowd 2 does not. This is not the case when the region is stated explicitly. The following works as expected. ]
[ Every turn when the location is in Region 1, now Crowd 2 is in the location. ]

Test all with "showme / n / showme".

Additional information :

imported from: [Mantis 1501] Containment of the location in a set of nested regions incorrectly evaluated.
  • status: Closed
  • resolution: Resolved
  • resolved: 2022-04-07T04:58:39+10:00
  • imported: 2022/01/10
curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by graham :
Fixed, by improving kind-checking at compile time.

curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by zarf :
Confirmed. Region expressions seem to produce different conditional I6 code than literal region names.

A simpler way to demonstrate the problem for the above code:


Every turn:
let R be the territory of Crowd 2;
say "R is [R]...";
if the location is in Region 1:
say "Check (1a).";
if the location is in R:
say "Check (1b).";

R is Region 1, but the two tests are compiled differently.


! [3: if the location is in region 1 begin]
if (((TestRegionalContainment(real_location,I125_region_1))))

{ ... }

! [6: if the location is in r begin]
if (((tmp_0 == ContainerOf(real_location)))){ ... }

curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by zarf :
I think this has to be handled at run-time (given I7's policy of run-time typing for all kinds-of-object). I'm not sure how it would work, though. The "in" in the source code refers to either the containment relation or the regional containment relation, but you can't know which until run-time. This is messy.

The original source code can be fixed by explicitly saying

Every turn when the location is regionally in the territory of Crowd 1, ...
Every turn when the location is regionally in the territory of Crowd 2, ...