version: kolmafia 17130
I think there is a minor bug in function overloading resolution. A similarly-named function taking a string is matched instead of one taking the exact type (if the former appears before the latter):
If you swap the position of the two function definitions it works properly.
Maybe somehow related to the way overload resolution works for string to_string(any)?
I searched and didn't see any other relevant posts about this.
I think there is a minor bug in function overloading resolution. A similarly-named function taking a string is matched instead of one taking the exact type (if the former appears before the latter):
Code:
string[int] to_array(string _string)
{
print("Called: string[int] to_array(string _string)");
string[int] result; result[0] = _string; return result;
}
int[effect] to_array(boolean[effect] effects)
{
print("Called: int[effect] to_array(boolean[effect] effects)");
int[effect] result;
return result;
}
$effects[Got Milk, Ode to Booze].to_array();
// Output:
// Called: string[int] to_array(string _string)
// Returned: aggregate string [int]
// 0 => aggregate boolean [effect]
If you swap the position of the two function definitions it works properly.
Maybe somehow related to the way overload resolution works for string to_string(any)?
I searched and didn't see any other relevant posts about this.