MantisBT - Core Inform
View Issue Details
0000129Core InformKinds and type checkingpublic2010-06-25 16:342010-11-30 08:05
EmacsUser 
graham 
normalmildalways
closedfixed 
x86Mac OS X10.4
6E59 
6F95 
(serious/mild) Game compiles but misbehaves
0000129: Missing run-time type check assigning from a supertype to a subtype
Inform should insert a run-time type check at assignments where it cannot guarantee type safety. The attached code, for instance, takes advantage of the implicit typing of ``dim spot'' (a local object variable) to store scenery in a global declared as holding a room.
There is a room.
The place of origin is a room that varies.
The shadows are scenery.
When play begins:
let a dim spot be the shadows;
now the place of origin is a dim spot;
move the player to the place of origin.
No tags attached.
related to 0000445closed graham HTML for runtime problem P60 has the explanation cast in the wrong template 
related to 0000809closed graham I7 not escaped in RTP_WRONGASSIGNEDKIND messages 
Issue History
2010-06-25 16:34EmacsUserNew Issue
2010-06-25 16:36jmcgrewSeveritymild => serious
2010-06-25 16:36jmcgrewStatusnew => acknowledged
2010-06-25 20:03jmcgrewStatusacknowledged => confirmed
2010-07-01 00:44jmcgrewSeverityserious => mild
2010-07-06 13:36Ron NewcombNote Added: 0000252
2010-07-06 14:43EmacsUserNote Added: 0000253
2010-07-06 16:39jmcgrewNote Added: 0000255
2010-09-27 12:20grahamNote Added: 0000602
2010-09-27 12:20grahamStatusconfirmed => resolved
2010-09-27 12:20grahamResolutionopen => fixed
2010-09-27 12:20grahamAssigned To => graham
2010-10-25 21:14jmcgrewFixed in Version => 6F95
2010-10-28 00:30jmcgrewStatusresolved => closed
2010-11-30 08:05EmacsUserIssue cloned0000445
2010-11-30 09:01jmcgrewRelationship addedrelated to 0000445
2011-12-07 09:57EmacsUserRelationship addedrelated to 0000809

Notes
(0000252)
Ron Newcomb   
2010-07-06 13:36   
Isn't this issue with the "move the player to.." command, which does exactly what it is told, no questions asked? As opposed to "now the player is in..." which *does* ask questions?

I am under the impression that "move..to..." is directly exposing an old Inform6 function not unlike the I6 testing command ABSTRACT... TO...
(0000253)
EmacsUser   
2010-07-06 14:43   
Substituting

now the player is in the place of origin.

for the last line has no effect on the story output.
(0000255)
jmcgrew   
2010-07-06 16:39   
The issue is that "the place of origin" is always supposed to refer to a room. Inform gives a compile-time error if you say "The place of origin is the shadows", or if you set it directly at runtime with "now the place of origin is the shadows", but still allows you to set it by using a temporary variable with a broader type. That is, Inform knows it can't store a thing in a room variable, but assumes it can always store an object in a room variable, even though not all objects are rooms.

"move the player to the place of origin" is kind of a red herring here, since "move" is defined as taking two objects. You can just write "move the player to the shadows" independently of this bug.
(0000602)
graham   
2010-09-27 12:20   
Fixed; Inform now inserts the necessary code to perform the check at run-time. This test source, for example, produces the run-time problem message:

Attempt to set a variable to the wrong kind of object: you wrote 'now the place of origin is a dim spot', which sets the value to the shadows - but that doesn't have the kind 'room'.