Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000557Core InformAssertions and creationspublic2011-02-12 17:062014-05-07 07:34
Assigned Tograham 
Platformx86OSMac OS XOS Version10.5
Product Version6G60 
Target VersionFixed in Version6L02 
Summary0000557: Bogus errors when using both colon and comma forms within If statement.
DescriptionThe included code generates two errors. The first is bogus and should not be stated, as the problem is not indentions at all.

The second error is incorrect, as well, because the code causing the problem is not "Whee!...", it is "If the phone is blue,..."

These seem to indicate a problem with Inform's parsing of if/else if statements.
Minimal Source Text To Reproduce
Every turn:
	If (turn count is three):
		Now phone is silent;
	[Display phone status.]
	If the phone is ringing:
		If the phone is blue, say "Uh oh. Code blue. Better answer it.";
		Else if phone is green:
			Say "Whee! You know that Ziggberry is calling!"; 

Defecatory is a room. Phone is in Defecatory. Phone can be ringing or silent. Phone is ringing. Phone 
can be green, blue, or purple at random.
Additional InformationProblem. You wrote 'Else if phone is green' : but this seems to be misplaced since it is not placed within an 'if', as it must be. An 'otherwise' must be vertically underneath the 'if' to which it corresponds, at the same indentation.

Problem. The phrase or rule definition 'Every turn' is written using the 'colon and indentation' syntax for its 'if's, 'repeat's and 'while's, where blocks of phrases grouped together are indented one tab step inward from the 'if ...:' or similar phrase to which they belong. But the tabs here seem to be misaligned, and I can't determine the structure. The first phrase going awry in the definition seems to be 'Say "Whee! You know that Ziggberry is calling!"' , in case that helps.
TagsNo tags attached.
Effect(cosmetic) Error message is badly worded
Attached Files

- Relationships
related to 0000398closedgraham Code Block Underflow in Chapter 22/Stack Frames.w from single-line "else if" 

-  Notes
Jim Aikin (reporter)
2011-02-12 17:19

This problem is caused by Inform's attempt to allow more fluid English syntax using a comma after an if. The problem is in the line, "If the phone is blue, say...." Following an if with a comma is only allowed (I believe) if the rule is a simple one and that's the end of it.

The error messages are misleading. As a suggestion, the code structure shown should be allowed. Alternatively, the compiler should detect the true source of the problem and issue a better error message.
Poster (reporter)
2011-02-13 05:32

Are cosmetic issues ever addressed (aside from documentation)? Two errors are generated where one will suffice.

Yes, it would be better if Inform just didn't care about the comma vs. colon distinction at all.
EmacsUser (manager)
2011-02-16 15:29

As the Inform language currently stands, the first problem message is correct: the ``else'' is in fact not within the ``if,'' as Jim pointed out in the comments. The suggestion to allow this syntax is a feature request, so it should be placed on UserVoice rather than Mantis. But I can confirm the bug that the problem messages are misleading in these circumstances.
graham (administrator)
2011-10-15 03:30

Both problem messages are correctly issued, but the first is misleading. I've fixed this.

- Issue History
Date Modified Username Field Change
2011-02-12 17:06 Poster New Issue
2011-02-12 17:19 Jim Aikin Note Added: 0001014
2011-02-12 18:35 jmcgrew Effect (mild) Compiler accepts invalid code => (cosmetic) Error message is badly worded
2011-02-12 18:35 jmcgrew Severity mild => cosmetic
2011-02-12 18:56 jmcgrew Status new => acknowledged
2011-02-13 05:32 Poster Note Added: 0001017
2011-02-13 21:56 EmacsUser Relationship added related to 0000398
2011-02-16 15:29 EmacsUser Note Added: 0001034
2011-02-16 15:29 EmacsUser Status acknowledged => confirmed
2011-10-15 03:30 graham Note Added: 0001366
2011-10-15 03:30 graham Status confirmed => resolved
2011-10-15 03:30 graham Resolution open => fixed
2011-10-15 03:30 graham Assigned To => graham
2011-11-02 13:00 EmacsUser Relationship added has duplicate 0000786
2011-11-02 13:01 EmacsUser Relationship deleted has duplicate 0000786
2014-05-07 07:34 jmcgrew Fixed in Version => 6L02
2014-05-07 07:34 jmcgrew Status resolved => closed

Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker