Thread overview
[Issue 20258] alias this produces an infinite range when used with ranges
[Issue 20258] alias this produces an infinite range when used with hashmaps
Dec 03, 2019
berni44
Jul 07, 2022
Andrej Mitrovic
Dec 17, 2022
Iain Buclaw
December 03, 2019
https://issues.dlang.org/show_bug.cgi?id=20258

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@d-ecke.de
          Component|phobos                      |dmd

--- Comment #1 from berni44 <bugzilla@d-ecke.de> ---
I think, the bug is to be found in dmd and byKey is innocent. If not, the correct component is not phobos but druntime, because byKey is located there.

--
July 07, 2022
https://issues.dlang.org/show_bug.cgi?id=20258

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|alias this produces an      |alias this produces an
                   |infinite range when used    |infinite range when used
                   |with hashmaps               |with ranges

--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Simpler example:

-----
import std.stdio;
import std.range;

struct Set
{
    auto walk () { return [].only; }
    alias walk this;
}

void main()
{
    Set set;
    writeln(set);
}
-----

It has to do with ranges, not specifically hashmaps as previously thought.

I think somewhere in the formatter it's probably trying to invoke walk() multiple times, implicitly through that 'alias this'.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20258

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--