[SOLVED] AHK 1.1.33.02 triggers incorrect warnings
[SOLVED] AHK 1.1.33.02 triggers incorrect warnings
Upgraded from .32 to .33 and my .ahk file which includes #warn is raising numerous errors about subsequent code cannot be executed because of a previous return statement . . . . which is not true. Disabled #warn but unsure if it's a bug or it's a problem discovered by the updated interpreter. Info on the issue is most appreciated.
Last edited by ineuw on 05 Nov 2020, 15:07, edited 1 time in total.
Win 10 Professional 64bit 21H2 16Gb Ram AHK current as of 2021-12-26 .
Re: AHK 1.1.33.02 triggers incorrect warnings
It's warnings, not errors.
Please show the code to reproduce it, if you think the warnings are wrong.
If you look at #warn, you can see that you can also selectively disable this new warn category: #Warn Unreachable, Off
Yes, the new versions 1.1.33+ check for unreachable code (which was ignored before). So far, I haven't seen incorrect warnings from it.https://www.autohotkey.com/docs/AHKL_ChangeLog.htm#v1.1.33.00 wrote:Added #Warn Unreachable (warning mode)
Please show the code to reproduce it, if you think the warnings are wrong.
If you look at #warn, you can see that you can also selectively disable this new warn category: #Warn Unreachable, Off
Re: AHK 1.1.33.02 triggers incorrect warnings
Much thanks for the reply. Of the 7 warnings, 4 were logical visible errors which I corrected. The rest could only be eliminated by #Warn Unreachable, Off While I don't see why the warnings are triggered, I am very interested in your assessment at a glance. Can I post a 1,300 line code here?
Win 10 Professional 64bit 21H2 16Gb Ram AHK current as of 2021-12-26 .
Re: AHK 1.1.33.02 triggers incorrect warnings
Better use ahkbin: https://p.ahkscript.org/ and post the link here.
Re: AHK 1.1.33.02 triggers incorrect warnings
https://p.ahkscript.org/ didn't generate an unique url so I pasted it in pastebin. https://pastebin.com/c7zYqFSZ
Win 10 Professional 64bit 21H2 16Gb Ram AHK current as of 2021-12-26 .
Re: AHK 1.1.33.02 triggers incorrect warnings
I got three warnings:
(shortened)
That's a valid warning, because you have a stray ? in there:That makes it an unintentional one-line remapping, and autotrim, off (and following lines) unreachable.
And(shortened)
That is correct, detecthiddentext, on is unreachable code (the directive #ifwinactive has no effect on this line, it gets evaluated already at script start and only affects hotkeys/-strings, not a single line like this:Effectively (looking at code that is relevant for it), there is a return immediately above it.
Something similar is true forthe one-line hotkey above it makes detecthiddentext, off unreachable (that hotkey has an implicit return).
#Warn works correctly, afaics.
Code: Select all
Warning: This line will never execute, due to Return preceeding it.
Line#
950: Return
950: SetKeyDelay,-1
950: Send,{Blind}{? Up}
950: Return
---> 951: AutoTrim,off
952: selected =
That's a valid warning, because you have a stray ? in there:
Code: Select all
#-:: ?
autotrim, off
And
Code: Select all
Warning: This line will never execute, due to Return preceeding it.
Line#
1283: clipboard =
1284: SendInput,{text}{{Do not move to Commons}}
1285: Return
---> 1295: DetectHiddenText,on
1296: Send,{lshift down}{lbutton}{lshift up}
1296: Return
That is correct, detecthiddentext, on is unreachable code (the directive #ifwinactive has no effect on this line, it gets evaluated already at script start and only affects hotkeys/-strings, not a single line like this:
Code: Select all
return
; win+x WINDOWS MENU WHEN WINDOWS SHORTCUTS ARE ENABLED. Disabled through Ultimate Windows Tweaks - Disable Winkey shortcuts
; win+z UNASSIGNED
;;; mouse
; mbutton
#ifwinactive ahk_exe vivaldi.exe
detecthiddentext, on
mbutton::send, {lshift down}{lbutton}{lshift up}
Something similar is true for
Code: Select all
mbutton::send, {lshift down}{lbutton}{lshift up}
detecthiddentext, off
#Warn works correctly, afaics.
Re: AHK 1.1.33.02 triggers incorrect warnings
Again, much thanks for taking the time to check it. I got the identical results. I'll close the topic as solved.
Win 10 Professional 64bit 21H2 16Gb Ram AHK current as of 2021-12-26 .
Who is online
Users browsing this forum: Bing [Bot] and 281 guests