[v2.0-beta.7] Reserved words as properties. No error on first declaration. Topic is solved

Report problems with documented functionality
OpalMonkey
Posts: 18
Joined: 23 Jan 2014, 03:02

[v2.0-beta.7] Reserved words as properties. No error on first declaration.

29 Jul 2022, 08:17

I'm not entirely sure what to think of this one but assume it's a bug. When using a property named IsSet an error is thrown, but only when it is not the first property definition. I don't see why it would be reserved when used as a property, but can't be sure which is the bug.

After a little more testing, this seems to be the same for any reserved word (Edit: Well, with Is, In, and Contains, anyways). It never takes issue with the first property declared in a class.

Example code —tested on beta.6 and beta.7. It considers Test2 an issue, but not Test1:

Code: Select all

class Test1 {
	IsSet => ''
	Value => ''
}
class Test2 {
	Value => ''
	IsSet => ''
}
Error:

Code: Select all

Error:  The following reserved word must not be used as a variable name:
"IsSet"

	Line#
	002: }
	003: {
	003: Return ''
	003: }
	005: Test2
	005: {
	000: }
--->	006: {
lexikos
Posts: 9688
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2.0-beta.7] Reserved words as properties. No error on first declaration.

30 Jul 2022, 00:51

It is clearly not being used as a variable name, so the error referring to it as such is a bug.
Names of properties, methods and window groups are permitted to be reserved words.
Source: Concepts and Conventions | AutoHotkey v2
There should be no error.
OpalMonkey
Posts: 18
Joined: 23 Jan 2014, 03:02

Re: [v2.0-beta.7] Reserved words as properties. No error on first declaration.

30 Jul 2022, 17:24

Makes sense. I didn't see what reason there would be to reserve them here. Thanks for confirming.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 10 guests