28492, "jabraham17", "[Bug]: parenless procs don't get properly dynamically dispatched", "2026-03-04T16:28:33Z"
I found while writing a series of classes that parenless procs fail to be properly called when doing dynamic dispatch
class A {
proc foo { return 1; }
proc bar() { return 1; }
}
class B: A {
override proc foo { return 2; }
override proc bar() { return 2; }
}
proc get(): owned A {
return new B();
}
var x = get();
writeln(x.foo);
writeln(x.bar());
This program should print 2 twice, but the call to foo actually prints as 1. This is incorrect behavior and potentially quite confusing (it took me awhile to understand why my code was not working)
The simple workaround is to not try to override parenless procs.
Potentially related issue: Mixing paren-ful vs. paren-less versions of a method within a class hierarchy can lead to internal errors (segfaults) · Issue #22768 · chapel-lang/chapel · GitHub