Modify

#3902 closed Bug (Fixed)

Au3Check, Byref, Map.element

Reported by: anonymous Owned by:
Milestone: Future Release Component: Au3Check
Version: Other Severity: None
Keywords: 3.3.16.1-rc2 Cc:

Description

; Error:
; - Function with ByRef defined BEFORE usage
; - .element syntax used
;~ #cs
Global $Map[]
Func AddOne(ByRef $a)
	$a += 1
EndFunc
$Map.something = 123
ConsoleWrite($Map.something & @CRLF)
AddOne($Map.something)
ConsoleWrite($Map.something & @CRLF)
;~ #ce

; Error Solution 01:
; - Function with ByRef defined AFTER usage
; - .element syntax used
#cs
Global $Map[]
$Map.something = 123
ConsoleWrite($Map.something & @CRLF)
AddOne($Map.something)
ConsoleWrite($Map.something & @CRLF)
Func AddOne(ByRef $a)
	$a += 1
EndFunc
#ce

; Error Solution 02:
; - Function with ByRef defined BEFORE usage
; - ['element'] syntax used
#cs
Global $Map[]
Func AddOne(ByRef $a)
	$a += 1
EndFunc
$Map.something = 123
ConsoleWrite($Map.something & @CRLF)
AddOne($Map['something'])
ConsoleWrite($Map.something & @CRLF)
#ce

The shown code will result in a "AddOne() called with Const or expression on ByRef-param(s)" error. The two other arrangements of the same code will not result in this error, and if you disable Au3Check entirely, the code will run fine. So its an Au3Check-only problem, AutoIt itself is fine with it.

Attachments (0)

Change History (4)

comment:1 by Jos, on Jul 26, 2022 at 6:00:35 PM

Resolution: Fixed
Status: newclosed

Fixed by revision [12845]

comment:3 by nurupo <nurupo.contributions@…>, on Oct 19, 2022 at 11:44:55 PM

Fixed by revision [12847] in version: 3.3.16.1

I have 3.3.16.1 installed and this is not fixed, AU3Check still errors:

Func foo(ByRef $bar)
EndFunc

; Works
Global $map1[]
$map1["test"] = 0
foo($map1["test"])

; Errors
Global $map2[]
$map2.test = 0
foo($map2.test) ; <-- error: foo() called with Const or expression on ByRef-param(s).

Did the fix not make it into 3.3.16.1 for some reason? It's also not mentioned in the changelog.

in reply to:  3 comment:4 by Jos, on Oct 20, 2022 at 7:51:16 AM

Replying to nurupo <nurupo.contributions@…>:

Fixed by revision [12847] in version: 3.3.16.1

Did the fix not make it into 3.3.16.1 for some reason? It's also not mentioned in the changelog.

Correct... that TAG is wrong and the fix will be in the next Beta/Prod versions as 3.3.16.1 is just a fix release for some AutoIt3 issues

Version 0, edited on Oct 20, 2022 at 7:51:16 AM by Jos (next)

comment:5 by Jos, on Oct 20, 2022 at 7:56:25 AM

Milestone: Future Release

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.