www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Get compilation errors within opDispatch?

reply cc <cc nevernet.com> writes:
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`
Feb 17 2020
next sibling parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 2/17/20 8:41 AM, cc wrote:
 Is there any way to see the compilation errors that occurred within an =
 opDispatch template?
=20
 struct Foo {
  =C2=A0=C2=A0=C2=A0=C2=A0void opDispatch(string s, SA...)(SA sargs) {
  =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 literally anything;
  =C2=A0=C2=A0=C2=A0=C2=A0}
 }
 Foo foo;
 foo.hello(5);
=20
 Result:=C2=A0 Error: no property `hello` for type `Foo`
=20
 Desired result:=C2=A0 Error: undefined identifier `literally`
=20
Try dmd command line switch -verrors=3Dspec. Ali
Feb 17 2020
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
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...
Feb 17 2020
parent cc <cc nevernet.com> writes:
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.
Feb 17 2020