chapel
chapel copied to clipboard
[Bug]: cannot call defaulted interface method directly
The following code does not compile today, as the compiler does not recognize that foo
is a method of B
.
interface A {
proc Self.foo(x: int): void {
writeln("x ", x);
}
}
record B: A {
}
var x = new B();
x.foo(11);
This gives the following error:
foo.chpl:10: error: unresolved call 'B.foo(11)'
foo.chpl:10: note: because no functions named foo found in scope
However, the following does work
interface A {
proc Self.foo(x: int): void {
writeln("x ", x);
}
}
record B: A {
}
var x = new B();
proc callFoo(x: A) do x.foo(10);
callFoo(x);