Modify

Opened 18 years ago

Closed 15 years ago

#65 closed Bug (Wont Fix)

Au3Check gives wrong error with Const ByRef params

Reported by: Valik Owned by: Valik
Milestone: Component: Other
Version: 3.2.10.0 Severity: None
Keywords: Au3Check Cc:

Description (last modified by Valik)

The following code:

CallNonConst()
CallConst()

Func CallNonConst()
	Local $a = 32
	TakesConstByRef($a)
EndFunc

Func CallConst()
	Local Const $a = 32
	TakesConstByRef($a)
EndFunc


Func TakesConstByRef(Const ByRef $c)
	ConsoleWrite($c & @CRLF)
EndFunc

produces this error:

New AutoIt v3 Script.au3(15,37) : ERROR: TakesConstByRef() previously called with expression on Const ByRef param(s).
Func TakesConstByRef(Const ByRef $c)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
New AutoIt v3 Script.au3(6,20) : REF: first call to TakesConstByRef().
	TakesConstByRef($a)
	~~~~~~~~~~~~~~~~~~^
New AutoIt v3 Script.au3 - 1 error(s), 0 warning(s)

The error is wrong. The code is perfectly valid. The problem is using a non-const and a const in the same script with the same function. It seems Au3Check is trying to infer something incorrectly. If you modify both examples to be identical (Either add Const to the Local it's missing from or remove it from the one where it's present) then there is no error. All Au3Check needs to worry about is making sure a variable is being passed to the ByRef statement, it doesn't need to concern itself if the variable is Const or not.

Attachments (0)

Change History (4)

comment:1 by Valik, 18 years ago

Description: modified (diff)
Summary: Au3Check gives wrong warning with Const ByRef paramsAu3Check gives wrong error with Const ByRef params

comment:2 by Valik, 18 years ago

Owner: set to Jos
Status: newassigned

comment:3 by Valik, 18 years ago

Owner: changed from Jos to Valik
Severity: None

comment:4 by Jon, 15 years ago

Resolution: Wont Fix
Status: assignedclosed

Modify Ticket

Action
as closed The owner will remain Valik.

Add Comment


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