[a136] fail interpreted when "if" following an obj.as Topic is solved

Report problems with documented functionality
User avatar
aseiot
Posts: 79
Joined: 05 Mar 2017, 04:25

[a136] fail interpreted when "if" following an obj.as

Post by aseiot » 30 May 2021, 22:56

Code: Select all

o := {as : 1}
a := o.as
if a													; The following reserved word must not be used as a variable name: "if"
{
}

lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [a136] fail interpreted when "if" following an obj.as

Post by lexikos » 31 May 2021, 04:55

This bug applies to various expression keywords: as, and, contains, in, is, IsSet, not, or, super, unset

Some of those are interpreted as continuation operators, either because they should cause continuation when they are eventually implemented as operators, or just for simplicity since they are not valid in an expression anyway. The bug is that the continuation code sees the word as a keyword even when preceded by ..

It doesn't matter that if is on the next line. Any line after .as would be appended to the previous line. The "if" error message is just a symptom of the code being interpreted as:

Code: Select all

a := o.as if a
as isn't an expression operator as such, but can currently be used for continuation:

Code: Select all

try {
    (0/0)
} catch IndexError, MemberError, TypeError, ValueError, ZeroDivisionError as
    unrealisticallyLongVariableName {
    ListVars
}


Post Reply

Return to “Bug Reports”