Thread overview
[Issue 5596] New: SortedRange regression
Feb 16, 2011
David Simcha
Feb 16, 2011
David Simcha
Feb 17, 2011
David Simcha
Feb 17, 2011
David Simcha
Jul 12, 2011
yebblies
[Issue 5596] Regression(2.052): Different template alias parameters to the same literal result in different template instances
Jul 12, 2011
yebblies
Jul 20, 2011
Kenji Hara
Aug 04, 2011
Brad Roberts
February 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5596

           Summary: SortedRange regression
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2011-02-16 07:46:16 PST ---
The following code works on 2.051 but not 2.052 beta:

import std.range, std.algorithm, std.functional;

alias SortedRange!(string[], "a < b") Set;

Set readTfList(string setFile) {
    string[] raw;
    return pipe!(sort, uniq, array, assumeSorted)(raw);
}

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



--- Comment #1 from David Simcha <dsimcha@yahoo.com> 2011-02-16 07:46:57 PST ---
Forgot to paste in the error message.  Here it is:

d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(5415): Error: this for _input
needs to be type SortedRange not type SortedRange!(string[],"a < b")

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5596



--- Comment #2 from David Simcha <dsimcha@yahoo.com> 2011-02-16 19:33:35 PST ---
Here's a better-reduced test case.  Also see the comments in the test case for some insight into what's going on here.

import std.range;

// This alias is necessary but not sufficient to reproduce the bug.  Even
// changing the white space in the comparison function, i.e. "a < b" -> "a<b",
// prevents this bug from being reproduced.  Must have to do with multiple
// attempts to instantiate SortedRange with the same parameters.
alias SortedRange!(string[], "a < b") Set;

void main() {
    string[] raw;
    auto foo = assumeSorted(raw);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5596



--- Comment #3 from David Simcha <dsimcha@yahoo.com> 2011-02-16 19:48:48 PST ---
Also note that changing the comparison function in the assumeSorted line makes this bug go away, too.

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


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |yebblies@gmail.com
           Platform|Other                       |All
         OS/Version|Windows                     |All


--- Comment #4 from yebblies <yebblies@gmail.com> 2011-07-12 20:36:47 EST ---
Reduced:


struct X(alias a) { void fx() { a = 4; } int a; }

alias X!"a" x;

void y(alias b)() { X!b g; }

void main()
{
    y!("a")();
}

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


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|SortedRange regression      |Regression(2.052):
                   |                            |Different template alias
                   |                            |parameters to the same
                   |                            |literal result in different
                   |                            |template instances


--- Comment #5 from yebblies <yebblies@gmail.com> 2011-07-12 21:25:54 EST ---
https://github.com/D-Programming-Language/dmd/pull/240

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 20, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5596


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg@gmail.com


--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2011-07-19 23:06:32 PDT ---
This is same as issue 5046, and already fixed in D2.

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


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |braddr@puremagic.com
         Resolution|                            |FIXED


--- Comment #7 from Brad Roberts <braddr@puremagic.com> 2011-08-03 20:31:22 PDT ---
Confirmed that the test case in comment 4 works now as does the code in the description.  Closing.

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