Skip to content

Comments

Turn deprecation into error for issue 313#8443

Merged
dlang-bot merged 1 commit intodlang:masterfrom
RazvanN7:checkAccess_err
Oct 25, 2018
Merged

Turn deprecation into error for issue 313#8443
dlang-bot merged 1 commit intodlang:masterfrom
RazvanN7:checkAccess_err

Conversation

@RazvanN7
Copy link
Contributor

@RazvanN7 RazvanN7 commented Jul 3, 2018

No description provided.

@RazvanN7 RazvanN7 requested a review from MartinNowak as a code owner July 3, 2018 08:39
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
313 major [module] Fully qualified names bypass private imports

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#8443"

@wilzbach
Copy link
Contributor

wilzbach commented Jul 3, 2018

Looks like more tests need updating:

Test runnable/testdstress.d failed. The logged output: /home/braddr/sandbox/at-client/pull-3231085-Linux_64_32/dmd/generated/linux/release/64/dmd -conf= -m32 -Irunnable -odgenerated/runnable -ofgenerated/runnable/testdstress_0 runnable/testdstress.d runnable/testdstress.d(674): Deprecation: Built-in hex string literals are deprecated, use `std.conv.hexString` instead. runnable/testdstress.d(851): Deprecation: class allocators have been deprecated, consider moving the allocation strategy outside of the class runnable/testdstress.d(173): Error: package `dstress.run` is not accessible here runnable/testdstress.d(174): Error: package `dstress.run` is not accessible here runnable/testdstress.d(175): Error: package `dstress.run` is not accessible here runnable/testdstress.d(659): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. ============================== Test runnable/testdstress.d failed: 

static import pkgDIP37.datetime;
static assert(!__traits(compiles, def()));
pkgDIP37.datetime.def();
pkgDIP37.datetime.common.def();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than deleting this, should we instead add static import pkgDIP32.datetime.common, perhaps in a different scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the point in that: the code will error if that different scope does not include test7's scope.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative would be static assert(!__traits(compiles, ...)

@@ -2,11 +2,11 @@
REQUIRED_ARGS: -de
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove -de

@Geod24
Copy link
Member

Geod24 commented Jul 3, 2018

Do you plan to do the rest of the protection code as well ? Because the time as come, and we might as well just remove the protection code instead of issuing a specific error... The former is more user friendly, though.

@RazvanN7
Copy link
Contributor Author

RazvanN7 commented Jul 3, 2018

@Geod24 Do you refer to : #7241 ? I was thinking of adopting that PR

@Geod24
Copy link
Member

Geod24 commented Jul 3, 2018

Forgot there was a PR for it already... Yeah that was what I was thinking about.

@RazvanN7
Copy link
Contributor Author

RazvanN7 commented Jul 3, 2018

Looks like FreeBSD is spuriously failing again.

The deprecation phase for fully qualified names that bypassed private imports is finished

---
=========================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW run.dlang.io does support HAR

static import pkgDIP37.datetime;
static assert(!__traits(compiles, def()));
pkgDIP37.datetime.def();
pkgDIP37.datetime.common.def();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative would be static assert(!__traits(compiles, ...)

// PERMUTE_ARGS:

module dstress.run.module_01;
module run.module_01;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure why, but for dstress.run.module_01 you would get that dstress.run is not accessible from the current module; that is probably because there is no directory structure that matches the module declaration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the folder run doesn't exist either, does it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually its runnable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That module declaration looks like a leftover from when code was copied into the test/runnable directory. Can't we just get rid of it?

{
std.stdio.writefln("foo"); // deprecation before patch, now errors
}
==========================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Maybe use two separate file sections in the changelog entry?

@RazvanN7 RazvanN7 force-pushed the checkAccess_err branch 3 times, most recently from 6c57dd0 to 6af0031 Compare July 5, 2018 10:25
@wilzbach wilzbach added Merge:72h no objection -> merge The PR will be merged if there are no objections raised. Merge:auto-merge and removed Merge:72h no objection -> merge The PR will be merged if there are no objections raised. Merge:auto-merge labels Jul 5, 2018
@wilzbach
Copy link
Contributor

wilzbach commented Jul 5, 2018

@RazvanN7 looks like this needs more work. I can reproduce failure in ae locally.

ae 0.0.2230: building configuration "ae-test-library"...
utils/array.d(434,18): Error: template ae.utils.array.indexOf cannot deduce function from argument types !()(string, string), candidates are:
utils/array.d(168,12):        ae.utils.array.indexOf(T, D)(in T[] arr, in D val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))) && is(typeof(arr[0] == val)))
utils/array.d(176,12):        ae.utils.array.indexOf(T)(in T[] arr, in T[] val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))))
utils/array.d(465,20): Error: template instance `ae.utils.array.skipUntil!(immutable(char), string)` error instantiating
utils/array.d(474,19):        instantiated from here: eatUntil!(immutable(char), string)
utils/array.d(434,18): Error: template ae.utils.array.indexOf cannot deduce function from argument types !()(string, char), candidates are:
utils/array.d(168,12):        ae.utils.array.indexOf(T, D)(in T[] arr, in D val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))) && is(typeof(arr[0] == val)))
utils/array.d(176,12):        ae.utils.array.indexOf(T)(in T[] arr, in T[] val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))))
utils/array.d(465,20): Error: template instance `ae.utils.array.skipUntil!(immutable(char), char)` error instantiating
utils/array.d(476,19):        instantiated from here: eatUntil!(immutable(char), char)
utils/array.d(479,38): Error: template instance `ae.utils.array.eatUntil!cast(OnEof)0.eatUntil!(immutable(char), string)` error instantiating
utils/array.d(480,43): Error: template instance `ae.utils.array.eatUntil!cast(OnEof)1.eatUntil!(immutable(char), string)` error instantiating
utils/text/package.d(71,18): Error: template instance `ae.utils.text.eatLine!(immutable(char))` error instantiating
/home/seb/dlang/dmd/generated/linux/release/64/dmd failed with exit code 1.

@wilzbach
Copy link
Contributor

wilzbach commented Jul 5, 2018

Looked a bit closer and the (string, string) part is the reason for the failure.
The two overloads have !isSomeChar!T, s.t. they don't conflict with std.string. However, the import of std.string is missing and the errors are about calls to the string variant.
This would solve the problem:

public import std.string;

But as there was never a deprecation triggered, I'm not sure whether we can go ahead with this directly.
CC @CyberShadow what do you think? It's your library that is blocking this PR ;-)

Maybe related: CyberShadow/ae#33

@CyberShadow
Copy link
Member

But as there was never a deprecation triggered, I'm not sure whether we can go ahead with this directly.

Yes, that bug ought to be fixed first.

@JinShil
Copy link
Contributor

JinShil commented Jul 9, 2018

Yes, that bug ought to be fixed first.

I assume you're referring to a DMD bug. What specifically is the bug? Is it in bugzilla yet? Do you have a minimal test case to trigger the bug?

@JinShil
Copy link
Contributor

JinShil commented Aug 1, 2018

Is Jenkins dead now?

@wilzbach
Copy link
Contributor

wilzbach commented Aug 1, 2018

Yes.

@wilzbach
Copy link
Contributor

wilzbach commented Aug 1, 2018

Setting this to blocked, s.t. we remember that this can't be merged before the 2.082 has happened (~15.8).

Regarding the project failures:

@JinShil
Copy link
Contributor

JinShil commented Aug 20, 2018

I wonder why the stacktrace doesn't have line numbers

Might be fixed with dlang/druntime#2278

@ibuclaw
Copy link
Member

ibuclaw commented Sep 20, 2018

Setting this to blocked, s.t. we remember that this can't be merged before the 2.082 has happened (~15.8).

I do believe that we can unblock this now.

@PetarKirov
Copy link
Member

@RazvanN7 rebase pls

@RazvanN7
Copy link
Contributor Author

@ZombineDev Done.

@wilzbach
Copy link
Contributor

The ae failure at buildkite still looks genuine.

@PetarKirov
Copy link
Member

@CyberShadow can you take a look at the ae errors?

@CyberShadow
Copy link
Member

I literally can't. Could you please repaste the log?

If I build this PR with Digger, ae builds and passes tests successfully with the resulting DMD.

@Geod24
Copy link
Member

Geod24 commented Sep 23, 2018


~> bash
--
  | Generating test runner configuration 'ae-test-library' for 'library' (sourceLibrary).
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
  | Performing "unittest" build using dmd for x86_64.
  | ae 0.0.2281: building configuration "ae-test-library"...
  | utils/array.d(434,18): Error: template `ae.utils.array.indexOf` cannot deduce function from argument types `!()(string, string)`, candidates are:
  | utils/array.d(168,12):        `ae.utils.array.indexOf(T, D)(in T[] arr, in D val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))) && is(typeof(arr[0] == val)))`
  | utils/array.d(176,12):        `ae.utils.array.indexOf(T)(in T[] arr, in T[] val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))))`
  | utils/array.d(465,20): Error: template instance `ae.utils.array.skipUntil!(immutable(char), string)` error instantiating
  | utils/array.d(474,19):        instantiated from here: `eatUntil!(immutable(char), string)`
  | utils/array.d(434,18): Error: template `ae.utils.array.indexOf` cannot deduce function from argument types `!()(string, char)`, candidates are:
  | utils/array.d(168,12):        `ae.utils.array.indexOf(T, D)(in T[] arr, in D val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))) && is(typeof(arr[0] == val)))`
  | utils/array.d(176,12):        `ae.utils.array.indexOf(T)(in T[] arr, in T[] val) if (!isSomeChar!T && is(typeof(arr.countUntil(val))))`
  | utils/array.d(465,20): Error: template instance `ae.utils.array.skipUntil!(immutable(char), char)` error instantiating
  | utils/array.d(476,19):        instantiated from here: `eatUntil!(immutable(char), char)`
  | utils/array.d(479,38): Error: template instance `ae.utils.array.eatUntil!cast(OnEof)0.eatUntil!(immutable(char), string)` error instantiating
  | utils/array.d(480,43): Error: template instance `ae.utils.array.eatUntil!cast(OnEof)1.eatUntil!(immutable(char), string)` error instantiating
  | utils/graphics/color.d(498,45): Deprecation: integral promotion not done for `~b`, use '-transition=intpromote' switch or `~cast(int)(b)`
  | utils/graphics/color.d(498,45): Deprecation: integral promotion not done for `~b`, use '-transition=intpromote' switch or `~cast(int)(b)`
  | utils/graphics/color.d(498,45): Deprecation: integral promotion not done for `~b`, use '-transition=intpromote' switch or `~cast(int)(b)`
  | utils/graphics/color.d(498,45): Deprecation: integral promotion not done for `~b`, use '-transition=intpromote' switch or `~cast(int)(b)`
  | utils/graphics/color.d(498,45): Deprecation: integral promotion not done for `~b`, use '-transition=intpromote' switch or `~cast(int)(b)`
  | utils/text/package.d(71,18): Error: template instance `ae.utils.text.eatLine!(immutable(char))` error instantiating
  | dmd failed with exit code 1.
  | 🚨 Error: The command exited with status 2


@Geod24 Geod24 closed this Sep 23, 2018
@Geod24 Geod24 reopened this Sep 23, 2018
@CyberShadow
Copy link
Member

CyberShadow commented Sep 23, 2018

Those errors don't make sense, look at the surrounding code.

If I build this PR with Digger, ae builds and passes tests successfully with the resulting DMD.

Oops, forgot to add --compiler=dmd.

CyberShadow added a commit to CyberShadow/ae that referenced this pull request Sep 23, 2018
@CyberShadow
Copy link
Member

Pushed fix & tag.

@RazvanN7
Copy link
Contributor Author

Ping. I think this is ready to be merged.

@RazvanN7 RazvanN7 added the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Oct 23, 2018
@RazvanN7 RazvanN7 added Merge:auto-merge and removed Merge:72h no objection -> merge The PR will be merged if there are no objections raised. labels Oct 25, 2018
@dlang-bot dlang-bot merged commit 01a6a5e into dlang:master Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants