Skip to content
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

Issue 7105 - relax inout rules #735

Merged
merged 2 commits into from
Feb 19, 2012
Merged

Issue 7105 - relax inout rules #735

merged 2 commits into from
Feb 19, 2012

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Feb 19, 2012

Issue 7105 - relax inout rules

Now bug 5493 and bug 4251 was fixed, so inout function doesn't have inout return type works properly without breaking type system. So, there is no faults to do this.

Issue 7542 - inout parameter contravariant should be allowed Issue 7543 - inout opApply should work properly After relaxing inout rules, we can write useful inout opApply with delegate parameter that receives inout, and it should work properly. Supporting it will increase usefullness of inout type system.

@@ -4959,6 +4963,9 @@ int Type::covariant(Type *t, StorageClass *pstc)
// BUG: cannot convert ref to const to ref to immutable
// We can add const, but not subtract it
if (arg2->type->implicitConvTo(arg1->type) < MATCHconst)
#else
// Allow contravariant for only inout parameters, see bug 7542.
if (!(arg2->type->hasWild() && arg1->type->wildConvTo(arg2->type)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This breaks the type system.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your pointing out. I'll remove changes for 7542 and 7543.

WalterBright added a commit that referenced this pull request Feb 19, 2012
Issue 7105 - relax inout rules
@WalterBright WalterBright merged commit 98988d6 into dlang:master Feb 19, 2012
braddr pushed a commit to braddr/dmd that referenced this pull request Oct 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants