Bug 15900 – [REG 2.071] (Import deprecation) Public import ignored when using fully qualified name
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-08T22:47:00Z
Last change time
2016-08-08T10:24:39Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
dlang-bugzilla
Comments
Comment #0 by dlang-bugzilla — 2016-04-08T22:47:25Z
///////////// test.d /////////////
import std.datetime;
unittest
{
cast(void)core.time.hnsecs(1);
}
//////////////////////////////////
$ dmd -w -unittest -o- test.d
test.d(5): Deprecation: module core.time is not accessible here, perhaps add 'static import core.time;'
However, std.datetime publicly imports core.time, so the warning is spurious. The code compiles fine when NOT using the fully-qualified name.
Comment #1 by timothee.cour2 — 2016-06-13T18:21:49Z
(In reply to Vladimir Panteleev from comment #0)
> ///////////// test.d /////////////
> import std.datetime;
>
> unittest
> {
> cast(void)core.time.hnsecs(1);
> }
> //////////////////////////////////
>
> $ dmd -w -unittest -o- test.d
> test.d(5): Deprecation: module core.time is not accessible here, perhaps add
> 'static import core.time;'
>
> However, std.datetime publicly imports core.time, so the warning is
> spurious. The code compiles fine when NOT using the fully-qualified name.
still there in 2.071.1 beta 2
Comment #2 by timothee.cour2 — 2016-06-13T18:24:23Z
(In reply to Timothee Cour from comment #1)
> (In reply to Vladimir Panteleev from comment #0)
> > ///////////// test.d /////////////
> > import std.datetime;
> >
> > unittest
> > {
> > cast(void)core.time.hnsecs(1);
> > }
> > //////////////////////////////////
> >
> > $ dmd -w -unittest -o- test.d
> > test.d(5): Deprecation: module core.time is not accessible here, perhaps add
> > 'static import core.time;'
> >
> > However, std.datetime publicly imports core.time, so the warning is
> > spurious. The code compiles fine when NOT using the fully-qualified name.
>
> still there in 2.071.1 beta 2
this is also broken:
fun.d:
public import std.string
public static import std.string
main.d:
import fun;
void main(){
auto a=std.string.isNumeric("12");
// module std.string is not accessible here, perhaps add 'static import std.string;'
}
Comment #3 by code — 2016-07-05T20:57:08Z
I think handling this is simply missing. Will be added for the next point release.
Comment #4 by github-bugzilla — 2016-07-30T01:15:04Z
Commits pushed to stable at https://github.com/dlang/dmdhttps://github.com/dlang/dmd/commit/0a20f1d407281f61da5b6386fdbe762bab410200
fix Issue 15900 - public imports not accessible using FQN
- public imports in imported modules were not accessbile using their
FQN, this was an oversight when adding the package tree masking to fix
Bugzilla 313 (see #5426)
- fixed by recursively checking imported scopes for accessible packages
- reuse Module.insearch to not follow import cycles
- Uses the same reduced visibility distinction (only private vs. rest) as the
unqualified symbol search, b/c extending importedScopes to track rich
visibility (e.g. package(a.b)) was out of scope for a regression fix.
This should be implemented when combining the search/import w/
the symbol visibility mechanism.
https://github.com/dlang/dmd/commit/4caed5518c492341a23f1da890c2931e73e0296a
Merge pull request #5967 from MartinNowak/fix15900
fix Issue 15900 - public imports not accessible using FQN
Comment #5 by github-bugzilla — 2016-08-01T19:54:35Z