LYR-SEM0086
a call that more than one function of the name fits
A call's name reaches several functions — for example the same name imported from two modules — and more than one takes the number of arguments passed.
Explanation
A call chooses among functions of one name by its argument count. When two reachable declarations take that many, nothing chooses between them. Within one scope this is already refused at the declaration (LYR-SEM0085); it arises when the declarations come from different places.
Import only one of them under the name, rename one with as, or qualify the call with its module.
Wrong
//- src/main.lyr
import app.a { size };
import app.b { size };
fn main(): void {
let _ = size(3);
}
//- src/a.lyr
pub fn size(n: int): int { return n; }
//- src/b.lyr
pub fn size(n: int): int { return n * 2; }
Right
//- src/main.lyr
import app.a;
import app.b;
fn main(): void {
let _ = a.size(3) + b.size(3);
}
//- src/a.lyr
pub fn size(n: int): int { return n; }
//- src/b.lyr
pub fn size(n: int): int { return n * 2; }