-
-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 20789: -de should disable is(T : U) if T alias-this to U is deprecated unless in deprecated scope #11081
Conversation
|
Thanks for your pull request and interest in making D better, @FeepingCreature! 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 references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#11081" |
|
Hm, the Phobos error is genuine and an interesting problem. We're in a deprecated unittest block but we use edit: The real problem is that the edit: Maybe it has to return @thewilsonator probably best to remove the auto-merge, it's a nonstarter as written due to the painful |
|
@WalterBright Since it's a nontrivial amount of effort, let me give you a ping upfront regarding what you think of turning |
I don't think that's going to work. You could potentially have multiple paths to convert from one type to the other, e.g. |
I don't think so?
Ie. if your base |
|
The use case I have in mind is this: class Foo
{
int value;
alias value this;
}
class Bar : Foo
{
int otherValue;
deprecated alias otherValue this;
}
static assert(is(Bar : int)); |
|
Yes, which would pass just fine under my proposal because |
|
Auto-merge toggled on |
|
Auto-merge toggled off |
|
@FeepingCreature I can tell you that under no circumstance is @WalterBright going to accept changing the matching levels. We had this discussion before when trying to solve the overloading rules for alias this (this bug [1]) and I didn't manage to convince him to add a new level. I think that this PR makes a weaker case for changing the matching levels than [1]. |
|
Okay, I mean, I'm open to ideas. But I can't think of another way to do it other than maybe passing |
|
One solution would be to alter the innards of the From my experience, checking for alias this should be done only by calling resolveAliasThis which does all the necessary checks, however, the reality is that people (including myself) have used a ton of other methods similar to what you are doing in this patch. As a rule of thumb, alias this should always be resolved with a call to |
8779e99 to
5ce5502
Compare
|
Implemented @RazvanN7 's suggestion, thanks! edit: I didn't use edit: I think the interop test failures are coincidence. The LLVM downloader server seems to have issues rn. |
e7700be to
0c1a8bd
Compare
0c1a8bd to
cc1a761
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
|
|
||
| if (preventAliasThis && e.targ.ty == Tstruct) | ||
| { | ||
| if ((cast(TypeStruct) e.targ).implicitConvToWithoutAliasThis(e.tspec)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's so annoying that TypeClass and TypeStruct don't have a common ancestor like TypeAggregate. This sort of check has to always be duplicated.
|
ping edit: lemme rebase |
cc1a761 to
394ede1
Compare
|
Does DMD have too many CI tests? It seems like every second PR I make, some of the CI steps are broken... And never because something like "master is broken" but because some other, external infrastructure collapsed. It kinda diminishes the usefulness of CI. |
|
|
|
Oh yeah, I'm on slack. edit: I'm aware it fails for unrelated causes. That's kind of the problem... edit: rebased |
…f deprecated symbol as implicit conversion in is() when -de (deprecations as errors) is on.
394ede1 to
d1cd1b9
Compare
Don't indicate deprecated
alias thisoralias thisof deprecated symbol as implicit conversion iniswhen-de(deprecations as errors) is on.Example: