digitalmars.D - opDispatch swallowing errors really sucks
- Adam D. Ruppe (15/15) Jan 10 2020 class A {
- Sebastiaan Koppe (4/9) Jan 10 2020 Yeah, that one is terrible. I bumped into it myself when I wanted
- Ernesto Castellotti (3/18) Jan 12 2020 I think it happens because of issue
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.
Jan 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.
Jan 10 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
Jan 12 2020