Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda function formatting in error messages #17605

Open
dlangBugzillaToGithub opened this issue Aug 17, 2013 · 1 comment
Open

Lambda function formatting in error messages #17605

dlangBugzillaToGithub opened this issue Aug 17, 2013 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

bearophile_hugs reported this on 2013-08-17T14:16:42Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=10839

Description

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
@dlangBugzillaToGithub
Copy link
Author

snarwin+bugzilla commented on 2021-05-15T14:12:03Z

*** Issue 11263 has been marked as a duplicate of this issue. ***

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant