Function ABC(cmd1 as string,cmd2 as Integer=0,byRef cmd3 as Integer) As String
..... bunch of code
Return answer
End Function
Function ABC(cmd1 as string,cmd2 as Integer) As String
Dim Dummy as Integer // don't need this value
Return ABC(cmd1,cmd2,dummy)
End Function
Error = There is more than one item with this name and its not clear to which this refers
Error is on every call to ABC
EDIT : Corrrected INT to INTEGER which is what the real code actually has
I assumed as much
But this highlights a different issue where an error later in the list is actually the root cause of the problem so proceeding to fix error from first to last actually doesnt work properly because you end up focusing on an error that is a result of a cascade and not the original error
I know I submitted a case to make it so errors were listed in “order of encounter byt the compiler” so you could fix the first and that might fix many others that are a result of the cascade
Also, this may be a result of the IDE now whosing every error and not just the first error it encounters on a line.
Byt doing that you have this same issue and there’s no control about whether the compiler / IDE should / should not show all errors or just the first one on the line
There’s a feature request for that as well
EDIT : in fact that DOES seem to be the issue - the type mismatch
Right the first error you mentioned is NOT the error that needs to be fixed first (hence my long statement about the compiler should order error s by “first error on line 1, second error on line 1, first error on line 2, next error on line 2” etc (it doesnt do that right now and grops them by “type”) if you switch to viewing errors by location then it is more like what I describe
At least that way IF you fix the first error you may not get many that follow because of that first one
If you fix the parameter declaration to say
Function ABC(cmd1 as string,cmd2 as Integer,byRef cmd3 as Integer) As String
instead of Int then several other errors go away - they are a cascade from the “Unknown type” issue
Strange… very strange… I just REMOVED cmd2 from the CALLS (not the functions signature) and NOW it compiled
[quote=476127:@Norman Palardy]Right the first error you mentioned is NOT the error that needs to be fixed first
If you fix the parameter declaration to say
Function ABC(cmd1 as string,cmd2 as Integer,byRef cmd3 as Integer) As String
instead of Int then several other errors go away - they are a cascade from the “Unknown type” issue[/quote]
The INT vs INTEGER was only in the forum post , the actual code DID say Integer correctly
well I originally wrote it as Int and get exactly the error you described
fixing that one thing got rid of 3 errors and 7 warnings (the cascade of errors)
Both method signatures can be identical, so I am not surprised that the compiler worked as a complainer.
I think that with removing cmd2, you only removed the ambiguity for the compiler but not for the whole project.
I would rather remove the default value of 0 in the first ABC implementation, so that your code loses its ambiguity and you have either 2 integers to pass (ABC#1) or 1 (ABC#2).
Currently, it depends on the nature of the integers as variable or literal expression.
Which makes me share compilers confusion.