www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12242] New: conflict error with public imports

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12242

           Summary: conflict error with public imports
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timothee.cour2 gmail.com



16:59:52 PST ---
test.d:
module test;
public:
import std.string;
import std.algorithm;

main.d:
import test;
import std.string;
void main(){  auto a=" af ".strip;}

dmd -c -o- main.d
main.d(4): Error: test.strip at test.d conflicts with std.string.strip(C)(C[]
str) if (isSomeChar!C) at phobos/std/string.d(1268)

Remove any of the 4 imports and it'll compile.
Also, there's no line number in 'at test.d'

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12242


Timothee Cour <timothee.cour2 gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2 gmail.com
           Severity|critical                    |regression



17:01:08 PST ---
actually this is a regression (worked in 2.063)

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12242


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



06:53:55 EET ---
Introduced in https://github.com/D-Programming-Language/phobos/pull/1311, but
this really looks like a compiler bug in the vein of 314.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12242


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

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



https://github.com/D-Programming-Language/dmd/pull/3388

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12242


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



01:28:26 PDT ---
This is not a compiler bug. It has nothing to do with 314.

The problem is that 'strip' is defined in both std.string and std.algorithm.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12242




10:33:53 EET ---
This is a compiler bug because this program doesn't compile (as is expected):

/////// test.d //////
import std.algorithm;

void main()
{
    " af ".strip;
}
/////////////////////

And this program compiles (as it should):

/////// test.d //////
import std.algorithm;
import std.string;

void main()
{
    " af ".strip;
}
/////////////////////

Note that the above program differs from OP's only in how imports are
"funneled".

Therefore, there should be no conflict, because out of std.algorithm.strip and
std.string.strip, only one will work with those parameters.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12242





 This is not a compiler bug. It has nothing to do with 314.
 The problem is that 'strip' is defined in both std.string and std.algorithm.
This is a compiler bug on cross-module overload set handling. It's not directly related to issue 313 & 314.
 test.d:
 module test;
 public:
 import std.string;
 import std.algorithm;
In test.d, 'strip' is a cross module overload set (CMOS) of 'std.string.strip' and 'std.algorithm.strip'.
 main.d:
 import test;
 import std.string;
 void main(){  auto a=" af ".strip;}
In main.d, 'strip' is a CMOS of the CMOS in test.d and 'std.stding.strip'. So, the newly created CMOS should be merged to the set [std.string.strip, std.algorithm.strip]. But currently OverloadSet and template cannot be merged into one OverloadSet object in ScopeDsymbol::search. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 23 2014