digitalmars.D - Wondering about =?UTF-8?Q?errors=E2=80=A6?=
- Russel Winder (16/16) May 27 2013 Using rdmd, it appears that the first error in the code can lead the
- Adam D. Ruppe (150/150) May 27 2013 Yeah, me too.
- Maxim Fomin (4/14) May 27 2013 "C++ is the only language where error message can be bigger than
- Russel Winder (38/39) May 27 2013 Phew, I'm so pleased it is not just me!
- Andrei Alexandrescu (3/6) May 27 2013 I'd say that deserves a bugzilla entry.
- Timon Gehr (3/10) May 30 2013 I have been trying to reduce a similar issue. What appears to trigger
- Rainer Schuetze (11/32) May 27 2013 I think most of these floods of errors come from not wanting to
- Timothee Cour (7/50) May 28 2013 I posted bugzilla entry:
- Walter Bright (13/19) May 27 2013 The usual approach to handling errors in a compiler is to guess at what ...
- Jacob Carlborg (21/33) May 28 2013 Clang is still a lot better on this than DMD. Take this simple example:
- Nick Sabalausky (4/28) May 28 2013 Is this what all the "error gagging" stuff is all about, or is there
- David Nadlinger (5/8) May 28 2013 No, error gagging is completely unrelated, it applies to
Using rdmd, it appears that the first error in the code can lead the parsing and template handling of everything following to be wrong. I keep finding that I am getting spurious errors about things nothing to do with the actual error, that simply go away when the real error is fixed. This would imply that most errors reported are generally spurious? --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
May 27 2013
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 declaration. Candidates are: /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(1982): std.format.formatRange(Writer, T, Char)(ref Writer w, ref T val, ref FormatSpec!(Char) f) if (isInputRange!(T)) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(1723): Error: template std.format.formatRange(Writer, T, Char)(ref Writer w, ref T val, ref FormatSpec!(Char) f) if (isInputRange!(T)) cannot deduce template function from argument types !()(Appender!(string),immutable(wchar)[],FormatSpec!(char)) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/conv.d(100): Error: template instance std.format.formatValue!(Appender!(string), immutable(wchar)[], char) error instantiating /home/me/d/dmd2/linux/bin32/../../src/phobos/std/conv.d(807): instantiated from here: toStr!(string, immutable(wchar)[]) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/conv.d(274): instantiated from here: toImpl!(string, immutable(wchar)[]) arsd/characterencodings.d(75): instantiated from here: to!(immutable(wchar)[]) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/conv.d(807): Error: template instance std.conv.toStr!(string, immutable(wchar)[]) error instantiating /home/me/d/dmd2/linux/bin32/../../src/phobos/std/conv.d(274): instantiated from here: toImpl!(string, immutable(wchar)[]) arsd/characterencodings.d(75): instantiated from here: to!(immutable(wchar)[]) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/conv.d(274): Error: template instance std.conv.toImpl!(string, immutable(wchar)[]) error instantiating arsd/characterencodings.d(75): instantiated from here: to!(immutable(wchar)[]) arsd/characterencodings.d(75): Error: template instance std.conv.to!(string).to!(immutable(wchar)[]) error instantiating /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(1718): Error: template std.array.Appender!(immutable(dchar)[]).Appender.put does not match any function template declaration. Candidates are: /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2305): std.array.Appender!(immutable(dchar)[]).Appender.put(U)(U item) if (isImplicitlyConvertible!(U, T) || isSomeChar!(T) && isSomeChar!(U)) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2325): std.array.Appender!(immutable(dchar)[]).Appender.put(Range)(Range items) if (isInputRange!(Unqual!(Range)) && !isInputRange!(Range)) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2334): std.array.Appender!(immutable(dchar)[]).Appender.put(Range)(Range items) if (isInputRange!(Range) && is(typeof(Appender.init.put(items.front)))) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2305): Error: template std.array.Appender!(immutable(dchar)[]).Appender.put cannot deduce template function from argument types !()(immutable(dchar)[]) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(1719): Error: template std.array.Appender!(immutable(dchar)[]).Appender.put does not match any function template declaration. Candidates are: /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2305): std.array.Appender!(immutable(dchar)[]).Appender.put(U)(U item) if (isImplicitlyConvertible!(U, T) || isSomeChar!(T) && isSomeChar!(U)) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2325): std.array.Appender!(immutable(dchar)[]).Appender.put(Range)(Range items) if (isInputRange!(Unqual!(Range)) && !isInputRange!(Range)) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2334): std.array.Appender!(immutable(dchar)[]).Appender.put(Range)(Range items) if (isInputRange!(Range) && is(typeof(Appender.init.put(items.front)))) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(2305): Error: template std.array.Appender!(immutable(dchar)[]).Appender.put cannot deduce template function from argument types !()(immutable(dchar)[]) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(1720): Error: template std.array.replaceInto does not match any function template declaration. Candidates are: /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(1729): std.array.replaceInto(E, Sink, R1, R2)(Sink sink, E[] subject, R1 from, R2 to) if (isOutputRange!(Sink, E) && isDynamicArray!(E[]) && isForwardRange!(R1) && isForwardRange!(R2) && (hasLength!(R2) || isSomeString!(R2))) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/array.d(1720): Error: template std.array.replaceInto(E, Sink, R1, R2)(Sink sink, E[] subject, R1 from, R2 to) if (isOutputRange!(Sink, E) && isDynamicArray!(E[]) && isForwardRange!(R1) && isForwardRange!(R2) && (hasLength!(R2) || isSomeString!(R2))) cannot deduce template function from argument types !()(Appender!(immutable(dchar)[]),immutable(dchar)[],immutable(dchar)[],immutable(dchar)[]) arsd/html.d(1995): Error: template instance std.array.replace!(immutable(dchar), immutable(dchar)[], immutable(dchar)[]) error instantiating /home/me/d/dmd2/linux/bin32/../../src/phobos/std/range.d(608): Error: static assert "Cannot put a immutable(dchar) into a Appender!(immutable(dchar)[])" /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(1691): instantiated from here: put!(Appender!(immutable(dchar)[]), immutable(dchar)) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(2079): instantiated from here: formatValue!(Appender!(immutable(dchar)[]), immutable(dchar), dchar) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(1723): instantiated from here: formatRange!(Appender!(immutable(dchar)[]), immutable(dchar)[], dchar) /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(2863): ... (1 instantiations, -v to show) ... /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(415): instantiated from here: formatGeneric!(Appender!(immutable(dchar)[]), immutable(dchar)[], dchar) arsd/html.d(2047): instantiated from here: formattedWrite!(Appender!(immutable(dchar)[]), dchar, immutable(dchar)[],immutable(dchar)[],immutable(dchar)[],immutable(dchar)[],immutable(dchar)[]) make: *** [all] Error 1 I'm not making that up. dmd has been doing it for several releases now - I noticed it started up when I started using ctRegex in cgi.d and keep hoping it will go away with each release. The only relevant line there is: base.d(2141): Error: undefined identifier gf, did you mean template to(T)? Remember, all I changed in this whole (working) program was the addition of "gf;" in the middle of it.
May 27 2013
On Monday, 27 May 2013 at 11:51:45 UTC, Adam D. Ruppe wrote:Yeah, me too. 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 declaration. Candidates are: /home/me/d/dmd2/linux/bin32/../../src/phobos/std/format.d(1982): std.format.formatRange(Writer, T, Char)(ref Writer w, ref <screens of errors> make: *** [all] Error 1"C++ is the only language where error message can be bigger than the program". Unfortunately this happens sometimes in D too.
May 27 2013
On Mon, 2013-05-27 at 13:51 +0200, Adam D. Ruppe wrote:Yeah, me too.Phew, I'm so pleased it is not just me! My problem was forgetting an import. I am using std.array.split in one function and std.stdio.writef in a completely separate function. With split imported correctly everything compiles and runs as expected and required. Forgetting the import of split(*), I get: wc.d(11): Error: undefined identifier 'split' /usr/include/dmd/phobos/std/range.d(611): Error: static assert "Cannot put= a char[] into a Appender!(string)" /usr/include/dmd/phobos/std/format.d(1436): instantiated from here: = put!(Appender!(string), char[]) /usr/include/dmd/phobos/std/format.d(1338): instantiated from here: = formatUnsigned!(Appender!(string), char) /usr/include/dmd/phobos/std/format.d(1312): instantiated from here: = formatIntegral!(Appender!(string), ulong, char) /usr/include/dmd/phobos/std/conv.d(100): ... (13 instantiations, -v = to show) ... /usr/include/dmd/phobos/std/stdio.d(1784): instantiated from here: w= ritefln!(char, immutable(int),immutable(int),immutable(int),string) wc.d(18): instantiated from here: writefln!(string,immutable(int),im= mutable(int),immutable(int),string) Which definitely results in a ***WTF***. How can a missing import cause this insane error report? If I use -v it looks even worse. (*) I am not a fan of importing all symbols from a module, so I always use selective imports. Whilst Python has no problem with imports and name spaces, Java, Scala, Groovy and D have horrible problems since the import imports into the current namespace. Obviously C++ is just a problem here due to textual inclusion rather than a module system. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
May 27 2013
On 5/27/13 7:51 AM, Adam D. Ruppe wrote:Yeah, me too. I take a working program and add "gf" to the middle of it. Here's the errors:I'd say that deserves a bugzilla entry. Andrei
May 27 2013
On 05/27/2013 10:12 PM, Andrei Alexandrescu wrote:On 5/27/13 7:51 AM, Adam D. Ruppe wrote:I have been trying to reduce a similar issue. What appears to trigger the message is that DMD sometimes evaluates isInputRange!string as false.Yeah, me too. I take a working program and add "gf" to the middle of it. Here's the errors:I'd say that deserves a bugzilla entry. Andrei
May 30 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 1I 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).
May 27 2013
I posted bugzilla entry: http://d.puremagic.com/issues/show_bug.cgi?id=10177a few days ago. In short, it says: 'why not just stop semantic3 passes at 1st error occurence' ? Other entries related to irrelevant error messages that I've recently reported:10169 , 10141, 10177. On Mon, May 27, 2013 at 11:43 PM, Rainer Schuetze <r.sagitario gmx.de>wrote: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 1I 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).
May 28 2013
On 5/27/2013 4:32 AM, Russel Winder wrote:Using rdmd, it appears that the first error in the code can lead the parsing and template handling of everything following to be wrong. I keep finding that I am getting spurious errors about things nothing to do with the actual error, that simply go away when the real error is fixed. This would imply that most errors reported are generally spurious?The usual approach to handling errors in a compiler is to guess at what the user actually meant, repair the AST according to that guess, then continue on. Unfortunately, the guess is usually wrong and the result is cascaded errors, of which only the first is meaningful. DMD has been gradually switching over to a more novel approach, one that I haven't seen elsewhere. Once an error is discovered, the AST is marked as "erroneous". That erroneous state propagates upwards to the root of the AST, and that any AST that relies on an erroneous AST is itself erroneous, and no further error messages are emitted for it. The result should be that only "original sin" errors are reported. This has already resulted in a great reduction of spurious error messages, but clearly we have more work to do.
May 27 2013
On 2013-05-27 22:32, Walter Bright wrote:The usual approach to handling errors in a compiler is to guess at what the user actually meant, repair the AST according to that guess, then continue on. Unfortunately, the guess is usually wrong and the result is cascaded errors, of which only the first is meaningful. DMD has been gradually switching over to a more novel approach, one that I haven't seen elsewhere. Once an error is discovered, the AST is marked as "erroneous". That erroneous state propagates upwards to the root of the AST, and that any AST that relies on an erroneous AST is itself erroneous, and no further error messages are emitted for it. The result should be that only "original sin" errors are reported. This has already resulted in a great reduction of spurious error messages, but clearly we have more work to do.Clang is still a lot better on this than DMD. Take this simple example: void main () { int a = 3 // Missing semicolon, line 3 int b = 5; } Compiling this with DMD gives the following error: main.d(4): Error: semicolon expected, not 'int' Where's Clang gives the following error for the same code: main.c:3:11: error: expected ';' at end of declaration int a = 3 ^ ; 1 error generated. It knows that you most likely meant to put the semicolon on the end of line 3 instead of the beginning of line 4. It also don't give completely false spell checking suggestion, like Adam showed: Error: undefined identifier gf, did you mean template to(T) -- /Jacob Carlborg
May 28 2013
On Mon, 27 May 2013 13:32:46 -0700 Walter Bright <newshound2 digitalmars.com> wrote:On 5/27/2013 4:32 AM, Russel Winder wrote:Is this what all the "error gagging" stuff is all about, or is there more to that?Using rdmd, it appears that the first error in the code can lead the parsing and template handling of everything following to be wrong. I keep finding that I am getting spurious errors about things nothing to do with the actual error, that simply go away when the real error is fixed. This would imply that most errors reported are generally spurious?The usual approach to handling errors in a compiler is to guess at what the user actually meant, repair the AST according to that guess, then continue on. Unfortunately, the guess is usually wrong and the result is cascaded errors, of which only the first is meaningful. DMD has been gradually switching over to a more novel approach, one that I haven't seen elsewhere. Once an error is discovered, the AST is marked as "erroneous". That erroneous state propagates upwards to the root of the AST, and that any AST that relies on an erroneous AST is itself erroneous, and no further error messages are emitted for it. The result should be that only "original sin" errors are reported. This has already resulted in a great reduction of spurious error messages, but clearly we have more work to do.
May 28 2013
On Tuesday, 28 May 2013 at 19:10:54 UTC, Nick Sabalausky wrote:Is this what all the "error gagging" stuff is all about, or is there more to that?No, error gagging is completely unrelated, it applies to "speculative evaluation" of code. The most obvious example for that is __traits(compiles, ...). David
May 28 2013