Thread overview
opDispatch swallowing errors really sucks
Jan 10, 2020
Adam D. Ruppe
Jan 10, 2020
Sebastiaan Koppe
January 10, 2020
class A {
    void opDispatch(string s)() {
        static assert(0);
    }
}

void main() {
    A a = new A;
    a.test();
}

$ test.d(9): Error: no property test for type test.A


Did you typo it? Is it proxying a function call with wrong arguments? Who knows. Here's my proposal: if opDispatch is considered, its errors get printed. If you don't want that spam, use a template constraint to remove it from consideration entirely.
January 10, 2020
On Friday, 10 January 2020 at 14:58:47 UTC, Adam D. Ruppe wrote:
> Did you typo it? Is it proxying a function call with wrong arguments? Who knows. Here's my proposal: if opDispatch is considered, its errors get printed. If you don't want that spam, use a template constraint to remove it from consideration entirely.

Yeah, that one is terrible. I bumped into it myself when I wanted to give the end-user a nice error message at compile time, instead what he got was a cryptic no property error.
January 12, 2020
On Friday, 10 January 2020 at 14:58:47 UTC, Adam D. Ruppe wrote:
> class A {
>     void opDispatch(string s)() {
>         static assert(0);
>     }
> }
>
> void main() {
>     A a = new A;
>     a.test();
> }
>
> $ test.d(9): Error: no property test for type test.A
>
>
> Did you typo it? Is it proxying a function call with wrong arguments? Who knows. Here's my proposal: if opDispatch is considered, its errors get printed. If you don't want that spam, use a template constraint to remove it from consideration entirely.

I think it happens because of issue https://issues.dlang.org/show_bug.cgi?id=14145