D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10839 - Lambda function formatting in error messages
Summary: Lambda function formatting in error messages
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P3 normal
Assignee: No Owner
URL:
Keywords:
: 11263 (view as issue list)
Depends on:
Blocks:
 
Reported: 2013-08-17 14:16 UTC by bearophile_hugs
Modified: 2024-12-13 18:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2013-08-17 14:16:42 UTC
In the following code if I define const foo, the code compiles:


import std.algorithm: map;
void main() {
    //const foo = (int x) => x; // OK
    enum foo = (int x) => x; // error
    [1].map!foo;
}


If I use enum foo I receive the error messages, dmd 2.064alpha:


...\dmd2\src\phobos\std\algorithm.d(410): Error: function std.algorithm.MapResult!(int(int x)

{

return x;

}

, int[]).MapResult.back cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(444): Error: function std.algorithm.MapResult!(int(int x)

{

return x;

}

, int[]).MapResult.front cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(456): Error: function std.algorithm.MapResult!(int(int x)

{

return x;

}

, int[]).MapResult.opIndex cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(396): Error: template instance std.algorithm.MapResult!(int(int x)

{

return x;

}

, int[]) error instantiating
bug.d(5):        instantiated from here: map!(int[])
bug.d(5): Error: template instance std.algorithm.map!(int(int x)

{

return x;

}

).map!(int[]) error instantiating



I think a better formatting for those error messages could be:

...\dmd2\src\phobos\std\algorithm.d(410): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.back cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(444): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.front cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(456): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.opIndex cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(396): Error: template instance std.algorithm.MapResult!(int(int x) { return x; }, int[]) error instantiating
bug.d(5):        instantiated from here: map!(int[])
bug.d(5): Error: template instance std.algorithm.map!(int(int x) { return x; }).map!(int[]) error instantiating
Comment 1 Paul Backus 2021-05-15 14:12:03 UTC
*** Issue 11263 has been marked as a duplicate of this issue. ***
Comment 2 dlangBugzillaToGithub 2024-12-13 18:10:28 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17605

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB