D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15900 - [REG 2.071] (Import deprecation) Public import ignored when using fully qualified name
Summary: [REG 2.071] (Import deprecation) Public import ignored when using fully quali...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2016-04-08 22:47 UTC by Vladimir Panteleev
Modified: 2016-08-08 10:24 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2016-04-08 22:47:25 UTC
///////////// 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 Timothee Cour 2016-06-13 18:21:49 UTC
(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 Timothee Cour 2016-06-13 18:24:23 UTC
(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 Martin Nowak 2016-07-05 20:57:08 UTC
I think handling this is simply missing. Will be added for the next point release.
Comment 4 github-bugzilla 2016-07-30 01:15:04 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://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 github-bugzilla 2016-08-01 19:54:35 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/0a20f1d407281f61da5b6386fdbe762bab410200
fix Issue 15900 - public imports not accessible using FQN

https://github.com/dlang/dmd/commit/4caed5518c492341a23f1da890c2931e73e0296a
Merge pull request #5967 from MartinNowak/fix15900
Comment 6 Martin Nowak 2016-08-08 10:24:39 UTC
https://github.com/dlang/dmd/pull/6014