[Issue 14973] New: [REG2.068] compiler inference of contexts for nested map seems broken

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 27 20:40:50 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14973

          Issue ID: 14973
           Summary: [REG2.068] compiler inference of contexts for nested
                    map seems broken
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: k.hara.pg at gmail.com

This is separated from issue 14962 because the root issue is not exactly same.

import std.range;
import std.algorithm;

class Foo {
    int baz() {    return 1;}
    void bar() {
        auto s = [1].map!(i => baz()); // compiles
        auto r = [1].map!(i => [1].map!(j => baz())); // error
    }
}

testfoo.d(8): Error: need 'this' for 'baz' of type 'int()'
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/algorithm/iteration.d(459):
       instantiated from here: MapResult!(__lambda2, int[])
testfoo.d(8):        instantiated from here: map!(int[])
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/algorithm/iteration.d(549):
       instantiated from here: __lambda2!int
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/algorithm/iteration.d(459):
       instantiated from here: MapResult!(__lambda2, int[])
testfoo.d(8):        instantiated from here: map!(int[])

--


More information about the Digitalmars-d-bugs mailing list