Thread overview
Get compilation errors within opDispatch?
Feb 17, 2020
cc
Feb 17, 2020
Ali Çehreli
Feb 17, 2020
Adam D. Ruppe
Feb 17, 2020
cc
February 17, 2020
Is there any way to see the compilation errors that occurred within an opDispatch template?

struct Foo {
	void opDispatch(string s, SA...)(SA sargs) {
		literally anything;
	}
}
Foo foo;
foo.hello(5);

Result:  Error: no property `hello` for type `Foo`

Desired result:  Error: undefined identifier `literally`

February 17, 2020
On 2/17/20 8:41 AM, cc wrote:
> Is there any way to see the compilation errors that occurred within an opDispatch template?
> 
> struct Foo {
>      void opDispatch(string s, SA...)(SA sargs) {
>          literally anything;
>      }
> }
> Foo foo;
> foo.hello(5);
> 
> Result:  Error: no property `hello` for type `Foo`
> 
> Desired result:  Error: undefined identifier `literally`
> 

Try dmd command line switch  -verrors=spec.

Ali

February 17, 2020
On Monday, 17 February 2020 at 16:41:54 UTC, cc wrote:
> Foo foo;
> foo.hello(5);
>
> Result:  Error: no property `hello` for type `Foo`

It sometimes helps to write it out log-form

foo.opDispatch!"hello"(5);

should give the full error.

this btw is one of the most annoying missing errors in d...
February 17, 2020
On Monday, 17 February 2020 at 17:01:12 UTC, Adam D. Ruppe wrote:
> It sometimes helps to write it out log-form
>
> foo.opDispatch!"hello"(5);
>
> should give the full error.
>
> this btw is one of the most annoying missing errors in d...

This worked, thank you!


On Monday, 17 February 2020 at 16:45:53 UTC, Ali Çehreli wrote:
> Try dmd command line switch  -verrors=spec.
>
> Ali

This technically also worked, but the error was buried on line 5431 of the 9857-line result.