www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5596] New: SortedRange regression

reply d-bugmail puremagic.com writes:
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



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: -------
Feb 16 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5596




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: -------
Feb 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5596




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: -------
Feb 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5596




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: -------
Feb 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 19 2011
prev sibling parent d-bugmail puremagic.com writes:
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



---
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: -------
Aug 03 2011