Thread overview
[Issue 24088] A nested function that returns a tuple that is written with short syntax function does not want to compile.
Aug 16, 2023
Nick Treleaven
Aug 16, 2023
Nick Treleaven
Aug 16, 2023
Dlang Bot
Aug 17, 2023
Dlang Bot
Sep 16, 2023
Dlang Bot
August 16, 2023
https://issues.dlang.org/show_bug.cgi?id=24088

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
Reduced:
```
import std.typecons;

void main()
{
    // Error: found `opp` when expecting `;` following statement `Tuple!(int,
int)` on line
   Tuple!(int, int) opp(int x, int y) => tuple(x + y, x - y); // no ok
}
```
BTW that error message has been improved in git master, it now says:

ft.d(12): Error: found `opp` when expecting `;` following expression
ft.d(12):        expression: `Tuple!(int, int)`

--
August 16, 2023
https://issues.dlang.org/show_bug.cgi?id=24088

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #2 from Nick Treleaven <nick@geany.org> ---
Reduced:
```
struct S(T) {}

void main()
{
    S!int f() => S!int();
}
```
I think I have a fix for isDeclarator in parse.d, will submit tomorrow.

--
August 16, 2023
https://issues.dlang.org/show_bug.cgi?id=24088

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@maxhaton created dlang/dmd pull request #15542 "Fix Issue 24088 - Nested functions using the shortened syntax were no…" fixing this issue:

- Fix Issue 24088 - Nested functions using the shortened syntax were not recognized correctly as declarations.

  The fix was simply to amend `isDeclarator` to look for TOK.goesTo (i.e. `=>`)

https://github.com/dlang/dmd/pull/15542

--
August 17, 2023
https://issues.dlang.org/show_bug.cgi?id=24088

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15542 "Fix Issue 24088 - Nested functions using the shortened syntax were no…" was merged into stable:

- 2504a1fdd429abf85fca02885ba527d741e70098 by mhh:
  Fix Issue 24088 - Nested functions using the shortened syntax were not
recognized correctly as declarations.

  The fix was simply to amend `isDeclarator` to look for TOK.goesTo (i.e. `=>`)

https://github.com/dlang/dmd/pull/15542

--
September 16, 2023
https://issues.dlang.org/show_bug.cgi?id=24088

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15609 "merge stable" was merged into master:

- e3eccfe9a5d721ea5dd1e4ab1d9bff7c6ae91ac4 by mhh:
  Fix Issue 24088 - Nested functions using the shortened syntax were not
recognized correctly as declarations.

  The fix was simply to amend `isDeclarator` to look for TOK.goesTo (i.e. `=>`)

https://github.com/dlang/dmd/pull/15609

--