MantisBT - Core Inform
View Issue Details
0002072Core InformPhrases and functional programmingpublic2018-09-06 00:172018-09-06 19:32
(serious/mild) Game compiles but misbehaves
0002072: Truth state properties accessed without specifier ("the x" rather than "the x of [thing]) always return true
I'm unsure if this is proper behavior. My uninformed guess is that the phrase looks for the variable in the wrong place and just grabs a word.

Regardless, this is an easy mistake for an author to make. Attempting to access a property as if it was a global variable should probably give a warning.
Jane is a woman. Jane has a truth state called x. X is false.
Check jumping when x is true: say "How peculiar!".
[Check jumping when x of Jane is false: say "Fixed."]

There is a room. Test me with "jump".
No tags attached.
Issue History
2018-09-06 00:17EleasNew Issue
2018-09-06 19:29zarfNote Added: 0004800
2018-09-06 19:29zarfStatusnew => confirmed
2018-09-06 19:32zarfNote Added: 0004801

2018-09-06 19:29   
This is definitely a bug, and it occurs for any property type. A more general test case:

Jane is a woman.
Jane has a truth state called x.
Jane has a text called y.

When play begins:
	if x is true:
		say "Peculiar 1.";
	if y is "yyy":
		say "Peculiar 2.";

The generated I6 code looks like:

    ! [2: if x is true]
    if ((((p15_x && true) == (1 && true))))
    {! [3: say ~Peculiar 1.~]
        say__p=1;! [4: ~Peculiar 1.~]
        ParaContent(); print "Peculiar 1."; new_line; .L_Say1; .L_SayX1;}
    ! [5: if y is ~yyy~]
    if (((p16_y == TX_L_45)))
    {! [6: say ~Peculiar 2.~]
        say__p=1;! [7: ~Peculiar 2.~]
        ParaContent(); print "Peculiar 2."; new_line; .L_Say2; .L_SayX2;}

The property constants p15_x and p16_y are being used nonsensically.
2018-09-06 19:32   
Interestingly, the expressions are being type-checked. That is, if you test "if y is true", you get:

In the sentence 'if y is true' , it looks as if you intend 'y is true' to be a condition, but that would mean comparing two kinds of value which cannot mix - a texts valued property and a truth state - so this must be incorrect.

So I guess it's incorrectly allowing "texts valued property" to mix with "text".