-
Notifications
You must be signed in to change notification settings - Fork 10.5k
RFC / DO NOT MERGE – Remove TVO_CanBindToInOut, add TVO_IsGenericTypeParam #15574
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
RFC / DO NOT MERGE – Remove TVO_CanBindToInOut, add TVO_IsGenericTypeParam #15574
Conversation
We want InOutType to go away and the majority of callers pass TVO_CanBindToInOut, therefore change the default to be TVO_CanBindToInOut and allow the weird cases that need reconciling to use TVO_CannotBindToInOut.
If InOutType doesn't exist, then "cannot bind" doesn't make sense.
@swift-ci please test |
It’s an interesting idea, but isn’t the inverted polarity spreading the flag even further implicitly? An audit of this flag should pretty much only need to conserve it around closures for inout inference - everywhere else is suspect (you found one place in the opening process that can be flipped already). |
Are you saying that the use of |
It's pretty much never needed. @slavapestov applied it to all the type variables at the time out of an abundance of caution. |
Got it. Thanks! |
FWIW, I looked at removing some of these recently, specifically in the pattern binding code that you've been working on, and the problem is that we then fail to get a solution in the solver for certain bogus expressions and then go on to produce a worse diagnostic. I think if we eliminate the inout-to-pointer conversions for operators (as seen here), we can make |
Build failed |
If the unary See |
@davezarzycki It's an error for InOutExpr to appear in an IfExpr like that anyway |
As a part of the ongoing "war on InOutType", I've made an attempt at cleaning up the TypeVariable options. After this patch series,
TVO_CanBindToInOut
is gone and the validation test suite still passes on my Linux box. Feedback would be appreciated. Please note that I did need to XFAIL one of the "compiler crasher" tests, but this seemed acceptable.