Skip to content

[Sema] Remove unneeded uses of TVO_CanBindToInOut #15580

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

Conversation

davezarzycki
Copy link
Contributor

In #15574, @CodaFi pointed out that @slavapestov added TVO_CanBindToInOut to the callers of createTypeVariable out of an "abundance of caution". This pull request removes TVO_CanBindToInOut as much as possible, without breaking the validation test suite. If this pull request is broken, then we probably need more tests to be added to the test suite.

@davezarzycki
Copy link
Contributor Author

@swift-ci please test

@xedin
Copy link
Contributor

xedin commented Mar 28, 2018

@swift-ci please test source compatibility

@davezarzycki davezarzycki requested a review from xedin March 28, 2018 18:32
@rudkx
Copy link
Contributor

rudkx commented Mar 28, 2018

My only concern here is whether diagnostics regress as a result of our now failing to produce a solution for a constraint system as opposed to producing a solution and then emitting a diagnostic after.

I suspect we do not have good test coverage for those cases. Can you take a look at that, and add some tests that exercise diagnosing & in invalid positions where before your change we would have produced a solution?

@xedin
Copy link
Contributor

xedin commented Mar 28, 2018

I think that is potentially fixable by Fixes (that's probably the only viable way to go).

@xedin
Copy link
Contributor

xedin commented Mar 28, 2018

I also think it would be very helpful for future us if this was documented somehow...

@davezarzycki
Copy link
Contributor Author

Hi @rudkx – I'm not clairvoyant, so if you know of new tests that need to be written, can you please elaborate? Thanks.

@CodaFi
Copy link
Contributor

CodaFi commented Mar 28, 2018

The tests here are particularly sensitive to changes in inout bindings. I'm pleasantly surprised they weren't tripped by these changes.

@davezarzycki
Copy link
Contributor Author

davezarzycki commented Mar 28, 2018

Hi @CodaFi – Well… That's what happens when one runs ninja swift-check-validation for each use of TVO_CanBindToInOut or lack thereof. :-)

@davezarzycki
Copy link
Contributor Author

How does one reproduce source compatibility failures? Specifically: ReactiveCocoa

@xedin
Copy link
Contributor

xedin commented Mar 28, 2018

@davezarzycki Looks like it's only ReactiveCocoa and it was caused by redeclaration fixes so consider it green for this case.

@davezarzycki
Copy link
Contributor Author

Super. Out of respect to the tentative "make reviewing mandatory" policy discussion, can somebody please bless this pull request with approval? Thanks!

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

I think it looks great! We are still trying to figure out what to do about diagnostics here. Let's why for @rudkx to bless it.

@rudkx
Copy link
Contributor

rudkx commented Mar 28, 2018

I didn't have a specific test case in mind. Just a general concern that when I attempted to remove the flag in getTypeForPattern we produced worse diagnostics. Perhaps we're not going to hit that in these other cases because they involve a RHS with & somewhere, which will produce an InOutExpr with the flag set on the type variable.

@slavapestov
Copy link
Contributor

@davezarzycki @rudkx I'm in favor of this change. If any diagnostics are discovered to have regressed later, we should fix how we diagnose inout. @xedin was looking at that. It's broken right now anyway.

@davezarzycki davezarzycki merged commit d4fd608 into swiftlang:master Mar 28, 2018
@davezarzycki davezarzycki deleted the remove_majority_of_TVO_CanBindToInOut branch March 28, 2018 22:32
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.

5 participants