Skip to content

Call resolving for languages without function overloading #1635

@peckto

Description

@peckto

It might be, that we are a little bit to strict with the current call resolving.
We always check the parameter types, also for languages where no function overloading exists.
This will not map function calls, where one of the parameters have an UNKNOWN type.

This is the relevant code part:

if (call.language !is HasFunctionOverloading) {
// If the function does not allow function overloading, and we have multiple candidate
// symbols, the
// result is "problematic"
if (result.candidateFunctions.size > 1) {
result.success = CallResolutionResult.SuccessKind.PROBLEMATIC
}
}
// Filter functions that match the signature of our call, either directly or with casts;
// those functions are "viable". Take default arguments into account if the language has
// them.
result.signatureResults =

Theoretically, for the "not HasFunctionOverloading" case, we could finish here with an ==1:

if (result.candidateFunctions.size > 1) {
result.success = CallResolutionResult.SuccessKind.PROBLEMATIC
}

Or we only take the shortcut, when one of the types is unknown.
Update: Of course, the number of arguments must match, otherwise something is going wrong.
What do you think?

Example where current call resolving fails:

//#define MY_CONST_INT 1

void foo(int i) {
}

int main() {
    foo(MY_CONST_INT);
    return 0;
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions