Skip to content

Commit

Permalink
Merge pull request #3834 from 9rnsr/fix11453
Browse files Browse the repository at this point in the history
Issue 11453 - Compiling packages has a dependency on order of modules passed to the compiler
  • Loading branch information
AndrejMitrovic authored and 9rnsr committed Aug 7, 2014
1 parent 8631eb8 commit a3b6ed6
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/module.c
Expand Up @@ -616,7 +616,7 @@ void Module::parse()
pkg->mod = this;
}
else
error(pkg->loc, "from file %s conflicts with package name %s",
error(md ? md->loc : loc, "from file %s conflicts with package name %s",
srcname, pkg->toChars());
}
else
Expand Down
2 changes: 1 addition & 1 deletion test/d_do_test.d
Expand Up @@ -322,7 +322,7 @@ string unifyNewLine(string str)

string unifyDirSep(string str, string sep)
{
return std.regex.replace(str, regex(`(?<=\w\w*)/(?=\w[\w/]*\.di?\b)`, "g"), sep);
return std.regex.replace(str, regex(`(?<=[-\w][-\w]*)/(?=[-\w][-\w/]*\.di?\b)`, "g"), sep);
}
unittest
{
Expand Down
1 change: 1 addition & 0 deletions test/fail_compilation/extra-files/bar11453.d
@@ -0,0 +1 @@
module foo11453.bar11453;
1 change: 1 addition & 0 deletions test/fail_compilation/extra-files/foo11453.d
@@ -0,0 +1 @@
module foo11453;
10 changes: 10 additions & 0 deletions test/fail_compilation/fail11453a.d
@@ -0,0 +1,10 @@
// REQUIRED_ARGS: -Ifail_compilation/extra-files
// EXTRA_SOURCES: extra-files/foo11453.d extra-files/bar11453.d
/*
TEST_OUTPUT
---
fail_compilation/extra-files/bar11453.d(1): Error: package name 'foo11453' conflicts with usage as a module name in file fail_compilation/extra-files/foo11453.d
---
*/

void main() {}
10 changes: 10 additions & 0 deletions test/fail_compilation/fail11453b.d
@@ -0,0 +1,10 @@
// REQUIRED_ARGS: -Ifail_compilation/extra-files
// EXTRA_SOURCES: extra-files/bar11453.d extra-files/foo11453.d
/*
TEST_OUTPUT
---
fail_compilation/extra-files/foo11453.d(1): Error: module foo11453 from file fail_compilation/extra-files/foo11453.d conflicts with package name foo11453
---
*/

void main() {}
8 changes: 4 additions & 4 deletions test/fail_compilation/test64.d
@@ -1,19 +1,19 @@
/*
TEST_OUTPUT:
---
Error: module imports from file fail_compilation/imports/test64a.d conflicts with package name imports
fail_compilation/imports/test64a.d(1): Error: module imports from file fail_compilation/imports/test64a.d conflicts with package name imports
---
*/

// PERMUTE_ARGS:

import std.stdio;
//import std.stdio;

import imports.test64a;

int main(char[][] args)
int main(string[] args)
{
writefln(file1);
//writefln(file1);
return 0;
}

0 comments on commit a3b6ed6

Please sign in to comment.