D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6272 - Named import in functions problem
Summary: Named import in functions problem
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
: 6465 6991 (view as issue list)
Depends on:
Blocks:
 
Reported: 2011-07-08 17:41 UTC by bearophile_hugs
Modified: 2012-01-20 09:45 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-07-08 17:41:27 UTC
This compiles correctly (DMD 2.054 beta):


import std.string: join;
void main() {
    string[] a = ["foo", "bar"];
    string s = join(a);
}



This too:

void main() {
    import std.string;
    string[] a = ["foo", "bar"];
    string s = join(a);
}



But this:

void main() {
    import std.string: join;
    string[] a = ["foo", "bar"];
    string s = join(a);
}


gives:
temp.d(4): Error: undefined identifier join, did you mean function main?
Comment 1 David Simcha 2011-08-10 20:44:07 UTC
*** Issue 6465 has been marked as a duplicate of this issue. ***
Comment 2 bearophile_hugs 2011-11-23 09:35:47 UTC
*** Issue 6991 has been marked as a duplicate of this issue. ***
Comment 3 Christian Kamm 2011-11-23 09:57:28 UTC
https://github.com/D-Programming-Language/dmd/pull/190 fixes this as well.
Comment 4 bearophile_hugs 2011-11-25 16:27:19 UTC
This seems a related problem:


void main() {
    import std.algorithm;
    auto data = new int[10];
    sort(data); // OK
    data.sort(); // Error: undefined identifier module temp.sort
}