Remove visiblity and lookup deprecation (Take 2)#9636
Remove visiblity and lookup deprecation (Take 2)#9636RazvanN7 merged 25 commits intodlang:masterfrom JinShil:dep_visible
Conversation
|
Thanks for your pull request and interest in making D better, @JinShil! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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 referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf 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#9636" |
|
@thewilsonator Not entirely sure why I was cc'ed. |
|
Because excel-d is failing with this PR: |
Next time try creating a draft PR: https://github.blog/2019-02-14-introducing-draft-pull-requests. |
Yep. Sorry I should have put that in the ping. |
|
I believe all the failures in buildkite are legitimate. The only thing I have left (I think) is to improve some of the error messages and prevent duplicate error messages. In other words, I think the applications that are failing need to be fixed. |
Geod24
left a comment
There was a problem hiding this comment.
Thanks for doing this. A few comments on error messages, but looks like you're still working on it.
test/fail_compilation/fail18979.d
Outdated
| --- | ||
| fail_compilation/fail18979.d(13): Deprecation: `imports.imp18979.Foo.__ctor(A)(A a)` is not visible from module `fail18979` | ||
| --- | ||
| fail_compilation/fail18979.d(14): Error: `imports.imp18979.Foo.__ctor(A)(A a)` is not visible from module `fail18979` |
There was a problem hiding this comment.
Shouldn't it be an "undefined identifier" error ?
Also, in a perfect world, we shouldn't show "__ctor" to the user (or any symbol which is not defined in code), but that was already the case before.
There was a problem hiding this comment.
How about now?
Edit: Actually I don't think the suggestion "did you mean imports.imp18979.Foo.__ctor(A)(A a)" shouldn't appear at all because it is private. I'll have to look into it.
src/dmd/access.d
Outdated
| return true; | ||
| } | ||
| // Access checks have been removed in favor of visibility checks. | ||
| // See https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP22.md |
There was a problem hiding this comment.
Shouldn't this whole function be reworked as a result ?
Not necessarily now tho.
There was a problem hiding this comment.
Yes, I'm hoping I can delete the entire function when I'm done.
There was a problem hiding this comment.
I couldn't get rid of it. It is called for some safety checks, specifically https://github.com/dlang/dmd/blob/master/test/fail_compilation/test18554.d
|
|
The Azure failure is pretty weird: I guess we split up building Phobos even more for win32 :/ |
BTW: the autotester uses posix.mak to build the phobos unittests in parallel and per file compilation on windows, too. See target |
|
I've fixed excel-d in the meanwhile. |
Yeah, but I guess the auto-tester machines have more memory? |
Might be, but single file compilation will likely need less memory and is what posix.mak does. If parallel builds are a problem due to memory resources, it could be used with JOBS=1. |
This might also help: #9650 |
|
I have done as much as I can with this. There is one bug remaining: Given the following files: module fail313;
import imports.a313;
void main()
{
imports.b313.bug();
}module imports.a313;
private import imports.b313;module imports.b313;
void bug() { }The error is emitted from the call to Lines 10993 to 11008 in a147141 The problem is it should have never gotten that far. The call to It's an existing bug in symbol lookup/visibility that is being masked by the now deprecated access checks. I need to fix that, and remove the call to |
|
@JinShil isn't removing |
No, I don't believe so. When DIP22 was implemented, it had to keep both visibility checks and access checks working until the deprecation of access checks (this PR) was finished. With visibility checks implemented, and access checks now fully deprecated, access checks are no longer needed. The problem, as the bug above illustrates, is that the visibility checks were not fully implemented; the original authors missed the one case illustrated in my previous comment.. After that case is resolved, We could pull this PR as is, since the call to |
|
I'm not sure you can remove that specific |
|
I hit a related problem just yesterday: https://issues.dlang.org/show_bug.cgi?id=19816 |
src/dmd/access.d
Outdated
| } | ||
| } | ||
| if (!result && (!(sc.flags & SCOPE.onlysafeaccess) || sc.func.setUnsafe())) | ||
|
|
There was a problem hiding this comment.
This is what you need for the buildkite fails.
+ if (smember.toParent().isTemplateInstance())
+ {
+ return false; // for backward compatibility
+ }There was a problem hiding this comment.
Thank you. I'd still like to do the refactoring as a followup after this PR is merged. This PR is already quite large, and I'd like to keep the friction low.
|
Yeah!!! All Green!!! What a relief!!! This PR is as good as I know how to make it at this time. As @Geod24 mentioned there are 2 error messages that are imperfect. They are not incorrect, but they could be better, which is like many error messages in D today. I did my best to improve them, but it appears they will require some refactoring of DMD to get the information needed. I don't know how to do that yet, and I think it would just add more difficulty to the review of this PR. I will follow up this PR with @SSoulaimane's suggestion to refactor access.d. This PR is already rather large and I would prefer not to cloud things with a refactoring. From my point of view, this is good to go. If you do choose to merge this, please be sure to close #7241. Thanks @MartinNowak for the initial work, and thanks everyone else for your help along the way. |
wilzbach
left a comment
There was a problem hiding this comment.
Looks very good! How about not removing the now failing tests, but just updating their error message with AUTO_UPDATE?
|
I don't believe I removed any tests, but the diff doesn't show what really happened. Some tests were just consolidated into one (e.g. the Edit: Also the reason the |
|
BTW, this is no longer a WIP |
All good. Thanks! Sorry for not seeing this immediately. |
|
BTW another nice thing about this PR is that we finally can convert the existing module imports to selective ones Phobos. In other words, we can all these selective comments: |
|
Thanks for this awesome work! |
|
And thanks to all of you for you reviews and ferrying this through the process. It feels so good to have this done. 👍 |
|
@SSoulaimane If you want to submit a PR to refactor access.d, please do. It was your work, so it would be nice if it were signed with your handle. |
|
@JinShil no it's yours just do it. I'll assist you if I can. |
|
This, specifically 8e9b2ca , seems to have accidentally fixed https://issues.dlang.org/show_bug.cgi?id=19536 . You can now pass a private symbol to a template alias and call it from the template without running into errors. I'm very happy about this, but is it intentional? |
No, that was not intentional, but I don't see why something like that should be prevented. There is currently an open question about whether we should support public aliases to private symbols. The compiler's behavior is currently inconsistent (some work -- e.g. templates -- and some don't). I don't have a way to force design decisions from the powers that be except through the DIP process, and the DIP process is quite disproportionate when all you want is a thoughtful decision. I think @Geod24 was going to follow up on this topic, but I'm not sure if that happened or will happen. The current implementation proactively prevents public aliases to private symbols, so a PR to allow it should only involve deleting code. Just by that alone, it seems like we're trying to enforce an arbitrary limitation, and I think it might be best to just to allow it, but that's not really my call to make. I could propose it by submitting a PR, but I'm not sure if I'm prepared to fight the battle that may ensue. |
This issue seems to have actually been fixed in: c2eefb0d8d850715f492197b0b1a033d9ad5411a dlang/dmd#9636 Add very basic test facility for independent test files.
b17712_c13.d was apparently fixed in: c2eefb0d8d850715f492197b0b1a033d9ad5411a dlang/dmd#9636 Add very basic test facility for independent test files.
b17712.d is not fixed in dmd, Phobos workaround: 2f20661 dlang#6659 b17712_c13.d was apparently fixed in dmd: c2eefb0d8d850715f492197b0b1a033d9ad5411a dlang/dmd#9636 Add very basic test facility for independent test files.
|
This pull request introduced a regression: |
Reboot of #7241
Credit to @MartinNowak
** This is not ready yet **