False postive with fully qualified command names
Brought to you by:
pspjuth
This code
proc cmd {a} {}
namespace eval main {
proc cmd {} {}
proc foo {} {
::cmd a
cmd
}
}
generates an error:
Line 5: E Wrong number of arguments (1) to "main::cmd"
But is perfectly legal.
With a quick look in the code I can't see where to begin. The arguments for lookForCommand are already missing the "::" prefix.
(This neither caused nor fixed by my recent pull request #16)
Looks like this is a regression caused by commit 73aeb9166e75e33cd50bd4fd6d1c0c4a729458d2
The main problem is the removal of :: in parseStatement, which makes it impossible to distinguish the call to "::cmd" and "cmd" downstream in the code. I do not recall why it was added in 73aeb.
But it all boils down to that the code mostly assumes "cmd" is global and that namespaces has been added later and not in a very good way.
I think the namespace resolution needs to be moved to early in parseStatement, but it is not obvious at a glance how.