← Back to index
|
Original Bugzilla link
Bug 8198 – Nested lambda inference doesn't work
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-04T20:56:00Z
Last change time
2012-06-12T15:56:03Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0
by k.hara.pg — 2012-06-04T20:56:30Z
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 } }
Comment #1
by k.hara.pg — 2012-06-05T00:18:53Z
https://github.com/D-Programming-Language/dmd/pull/981
Comment #2
by github-bugzilla — 2012-06-12T11:43:25Z
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