Thread overview
[Issue 8617] New: std.typecons.Proxy.opEquals compiles error: undefined identifier 'startsWith'
Sep 04, 2012
Li Jie
Sep 04, 2012
Jonathan M Davis
Sep 16, 2012
Kenji Hara
Nov 15, 2012
Kenji Hara
September 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8617

           Summary: std.typecons.Proxy.opEquals compiles error: undefined
                    identifier 'startsWith'
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: cpunion@gmail.com


--- Comment #0 from Li Jie <cpunion@gmail.com> 2012-09-04 01:01:56 PDT ---
--- code
struct MyString
{
    private string value;
    mixin Proxy!value;
    this(string s){ value = s; }
}

// Test BUG #
MyString a = MyString("a");
MyString b = MyString("b");
MyString a1 = MyString("a");
assert(a == a);
assert(a == a1);
assert(a != b);
---

--- compile
$ dmd testproxy.d
../src/phobos/std/typecons.d(2658): Error: undefined identifier 'startsWith'
testproxy.d(16): Error: template instance
testproxy.main.MyString.Proxy!(value).opEquals!(MyString) error instantiating
---

If the test code placed in typecons.d, it's ok.
If place it in another file, compiles error. Bug if add 'import std.algorithm',
compiles passed, why it depends user's context?

Seems it is a DMD's bug?

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


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-09-04 01:16:44 PDT ---
It works in std.typecons, because std.typecons imports std.algorithm. Your module doesn't, and you're mixing Proxy into your module, so it needs to import std.algorithm. This is _not_ a compiler bug.

Now that we have local imports, Proxy can have the import for std.algorithm internally, so that should probably be added. But previously, there was no way to have Proxy import what it needed, and you'd have to import it in whatever module you mixed it into. But fortunately, that's now fixable.

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


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

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


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-09-16 08:39:22 PDT ---
https://github.com/D-Programming-Language/phobos/pull/792

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



--- Comment #3 from github-bugzilla@puremagic.com 2012-09-16 16:25:17 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/bcf7dd9bd268956754bf1a034728bef29619e858
fix Issue 8617 - std.typecons.Proxy.opEquals compiles error: undefined
identifier 'startsWith'

https://github.com/D-Programming-Language/phobos/commit/1bd44a7549b876fecd021eab6fe59262e3c200dc Merge pull request #792 from 9rnsr/fix8617

Issue 8617 - std.typecons.Proxy.opEquals compiles error: undefined identifier 'startsWith'

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


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

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


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