www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5004] New: 'aka' usage in error messages

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004

           Summary: 'aka' usage in error messages
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-10-06 12:20:15 PDT ---
The Clang front-end of LLVM tries harder to give good error messages:
http://clang.llvm.org/diagnostics.html

One simple but nice feature of its error messages is the usage of "aka", this
is an example:

t.c:13:9: error: member reference base type 'pid_t' (aka 'int') is not a
structure or union


This is a wrong D2 program: 


void main() {
    alias int Foo;
    Foo f;
    f = f.x;
}


DMD 2.049 prints:
test.d(4): Error: no property 'x' for type 'int'

But a more useful error message can be:
test.d(4): Error: no property 'x' for type 'Foo' (aka 'int')

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 06 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nfxjfg gmail.com


--- Comment #1 from nfxjfg gmail.com 2010-10-06 20:55:51 PDT ---
That's a really nice idea!
Also see bug 4917.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 06 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|'aka' usage in error        |show both resolved symbols
                   |messages                    |and original identifier in
                   |                            |error messages involving
                   |                            |aliases


--- Comment #2 from nfxjfg gmail.com 2010-10-06 20:57:43 PDT ---
Trying to improve the bug report title, if you don't mind...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 06 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004



--- Comment #3 from bearophile_hugs eml.cc 2010-10-26 13:36:16 PDT ---
Another comment about it:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=120492

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004


Denis Derman <denis.spir gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |denis.spir gmail.com


--- Comment #4 from Denis Derman <denis.spir gmail.com> 2011-02-15 14:40:59 PST
---
(In reply to comment #0)
 The Clang front-end of LLVM tries harder to give good error messages:
 http://clang.llvm.org/diagnostics.html
 
 One simple but nice feature of its error messages is the usage of "aka", this
 is an example:
 
 t.c:13:9: error: member reference base type 'pid_t' (aka 'int') is not a
 structure or union
 
 
 This is a wrong D2 program: 
 
 
 void main() {
     alias int Foo;
     Foo f;
     f = f.x;
 }
 
 
 DMD 2.049 prints:
 test.d(4): Error: no property 'x' for type 'int'
 
 But a more useful error message can be:
 test.d(4): Error: no property 'x' for type 'Foo' (aka 'int')
Agreed, would be very nive. Have no idea at which stage in the "decoding" sequence name aliases are resoved, which certainly determines the difficulty of implementing the feature. Anyway, since D's term is 'alias', this term should be used in error messages instead of 'aka'. Also, 'aka' can be difficult for non-english speakers (have learnt it myself only recently, after decades of English practice). 'alias' does not have this issue due to beeing part of D's terminology. However, it goes in opposite sense, I guess: test.d(4): Error: no property 'x' for type 'Foo' (alias for 'int') Or maybe suppleness of English allows the following to be clear? test.d(4): Error: no property 'x' for type 'Foo' ('int' alias) Denis -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 15 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004



--- Comment #5 from bearophile_hugs eml.cc 2011-07-18 01:42:25 PDT ---
Another similar example of bad error message, DMD 2.054:

enum Foo { A }
void main() {
    auto x = Foo.B;
}


test.d(3): Error: no property 'B' for type 'int'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 18 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004



--- Comment #6 from bearophile_hugs eml.cc 2011-09-18 11:14:04 PDT ---
GCC too uses "aka" in error messages:


#include <stdint.h>
struct S { int16_t x; };
int main(int argc, char **argv) {
    S s = { argc };
    return 0;
}


...>g++ -std=c++0x temp.cpp -o temp
temp.cpp: In function 'int main(int, char**)':
temp.cpp:4:18: error: narrowing conversion of 'argc' from 'int' to 'int16_t
{aka short int}' inside { } [-fpermissive]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004



--- Comment #7 from bearophile_hugs eml.cc 2011-11-15 23:53:47 PST ---
Maybe related to issue 6916

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 15 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5004



--- Comment #9 from bearophile_hugs eml.cc 2012-05-06 06:52:35 PDT ---
One case:


alias ushort UT;
void main() {
    int x;
    UT y = x;
}


DMD 2.060alpha gives:

test.d(4): Error: cannot implicitly convert expression (x) of type int to
ushort

But a more useful error message is similar to:

test.d(4): Error: cannot implicitly convert expression (x) of type int to UT
(alias for ushort)


See also Issue 8044

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 06 2012