Thread overview
[Issue 8198] New: Nested lambda inference doesn't work
Jun 05, 2012
Kenji Hara
Jun 05, 2012
Kenji Hara
Jun 12, 2012
Walter Bright
June 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8198

           Summary: Nested lambda inference doesn't work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2012-06-04 20:56:30 PDT ---
Following code should work, but doesn't.

void main()
{
    T delegate(T) zero(T)(T delegate(T) f)
    {
        return x => x;
    }

    T delegate(T) delegate(T delegate(T)) succ(T)(T delegate(T) delegate(T
delegate(T)) n)
    {
        return f => x => f(n(f)(x));    // Line 10
// test.d(10): Error: function has no effect in expression (__lambda6)
// test.d(10): Error: template instance
test.main.succ!(uint).succ.__lambda4!(uint delegate(uint)) error instantiating
// test.d(21):        instantiated from here: succ!(uint)
// test.d(21): Error: template instance test.main.succ!(uint) error
instantiating
    }

    auto n = &zero!uint;
    foreach (i; 0..10)
    {
        assert(n(x => x + 1)(0) == 1);
        n = succ(n);                    // Line 21
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8198


Kenji Hara <k.hara.pg@gmail.com> changed:

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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-06-05 00:18:53 PDT ---
https://github.com/D-Programming-Language/dmd/pull/981

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8198



--- Comment #2 from github-bugzilla@puremagic.com 2012-06-12 11:43:25 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f9bf4a373260d2afc47814c904609d3fa39f4167 fix Issue 8198 - Nested lambda inference doesn't work

https://github.com/D-Programming-Language/dmd/commit/053ee7208565929297f027b9cff411b986336162 Merge pull request #981 from 9rnsr/fix_funclit

Issue 8198 - Nested lambda inference doesn't work

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8198


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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