Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: cannot call defaulted interface method directly #25799

Open
jabraham17 opened this issue Aug 22, 2024 · 0 comments
Open

[Bug]: cannot call defaulted interface method directly #25799

jabraham17 opened this issue Aug 22, 2024 · 0 comments

Comments

@jabraham17
Copy link
Member

jabraham17 commented Aug 22, 2024

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant