18565, "bradcray", "Resolution errors should focus on candidates with the same base type", "2021-10-13T00:18:37Z"
As a Chapel programmer, when I accidentally call a method incorrectly, it would be nice if the compiler would prioritize listing candidates with the same base type and method name over those with a different base type. As an example, for the following program:
class C {
proc foo() {
}
proc bar(x: int) {
}
}
class D {
proc foo() {
}
proc bar(x: real) {
}
}
class E {
proc foo() {
}
proc bar(x: string) {
}
}
record S {
proc foo(x: int) {
}
proc bar() {
}
}
proc int.foo() {
}
proc int.bar(x: bool) {
}
var myS: S;
myS.foo();
myS.bar(1);
the compiler tells me that it can't resolve myS.foo() (or bar(1), and lists C.foo(), D.foo(), E.foo() as candidates before mentioning S.foo(x: int)
which seems like the more likely routine I was trying to call.
Note that this issue is thematically related to Resolution failures should not show standalone function/method candidates that don't apply · Issue #16928 · chapel-lang/chapel · GitHub and implementing a solution may share code (or at least similar code paths) as https://github.com/chapel-lang/chapel/pull/16969.