The compiler swallows opDispatch errors
Adam D Ruppe
destructionator at gmail.com
Mon Aug 30 12:19:21 UTC 2021
On Monday, 30 August 2021 at 06:13:03 UTC, bauss wrote:
> I'd argue that opDispatch shouldn't have any constraints on it.
Well my rule would be if opDispatch is considered, the error
shoudl be printed.
But you can prevent opDispatch from being considered by putting a
constraint on it.
So
struct A {
void opDispatch(string s)() {
dfsdfsdf;
}
}
A a;
a.whatever; // REPORT THE FULL ERROR OMG
BUT
struct A {
void opDispatch(string s)() if(s != "whatever") {
dfsdfsdf;
}
}
A a;
a.whatever; // "no such property: whatver"
so you only get "no such property" if the opDispatch is not
considered at all because the outer constraint filtered it out.
More information about the Digitalmars-d
mailing list