Every arg in args needs to match. There are multiple different categories how an argument can match. Let f be the formal parameter’s type and a the type of the argument.
- Exact match: a and f are of the same type.
- Generic match: f is a generic type and a matches, for instance a is int and f is a generic (constrained) parameter type (like in [T] or [T: int|char].
- Integral conversion match: a is convertible to f and f and a is some integer or floating point type.
A routine p matches better than a routine q if the following algorithm returns true:
If this algorithm returns “ambiguous” further disambiguation is performed: If the argument a matches both the parameter type f of p and g of q via a subtyping relation, the inheritance depth is taken into account: