Wondering about errors…

Rainer Schuetze r.sagitario at gmx.de
Mon May 27 23:43:01 PDT 2013



On 27.05.2013 13:51, Adam D. Ruppe wrote:
> Yeah, me too.
>
> I take a working program and add "gf" to the middle of it. Here's the
> errors:
>
> base.d(2143): Error: found '{' when expecting ';' following statement
> base.d(2168): Error: unexpected ( in declarator
> base.d(2168): Error: basic type expected, not "div"
> base.d(2168): Error: found '"div"' when expecting ')'
> base.d(2168): Error: no identifier for declarator div.addChild(int)
> base.d(2168): Error: semicolon expected following function declaration
> base.d(2168): Error: Declaration expected, not ','
> base.d(2177): Error: Declaration expected, not 'if'
> base.d(2179): Error: no identifier for declarator qrUrl
> base.d(2180): Error: unrecognized declaration
>
>
> OK.... now let's add a semicolon to it. Prepare yourself, here's what
> dmd gives me now:
>
> base.d(2141): Error: undefined identifier gf, did you mean template to(T)?
> /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(1723): Error:
> template std.format.formatRange does not match any function template
[...]
> formattedWrite!(Appender!(immutable(dchar)[]), dchar,
> immutable(dchar)[],immutable(dchar)[],immutable(dchar)[],immutable(dchar)[],immutable(dchar)[])
>
> make: *** [all] Error 1
>

I think most of these floods of errors come from not wanting to 
instantiate templates once any (completely unrelated) error has been 
shown. This has improved, but I just found two instances of that in mtype.c:

     if (global.errors)
         return new ErrorExp();  // TemplateInstance::semantic() will 
fail anyway

The mechanism of not showing errors if they contain ErrorExp seems to 
not work in that case, but I think not even trying to do the 
instantiation is unreasonable (just stopping compilation would be better).


More information about the Digitalmars-d mailing list