-
Notifications
You must be signed in to change notification settings - Fork 10.5k
isInvalid() Is Finally Semantic #27922
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
@swift-ci please test |
@swift-ci please test source compatibility |
Build failed |
@swift-ci please smoke test macOS platform |
@swift-ci Please Test Source Compatibility Release |
@swift-ci please smoke test |
Love 2 have my build ICE'd @swift-ci Please Test Source Compatibility Release |
@swift-ci Please Test Source Compatibility Release |
@swift-ci please test |
@swift-ci please clean test macOS platform |
@swift-ci Please Test Source Compatibility Release |
This finally passes and naturally there's a merge conflict... |
Now that setInvalid() is a semantic property, drop the explicit calls to reset the interface type. It is already ErrorType.
Patch up all the places that are making a syntactic judgement about the isInvalid() bit in a ValueDecl. They may continue to use that query, but most guard themselves on whether the interface type has been set.
@swift-ci please smoke test |
⛵️ |
The
isInvalid()
bit is intended to be sync'd to the presence of anErrorType
in the interface type of aValueDecl
(for a regularDecl
, it's kinda higgledy-piggledy). Historically, this had to be handled in an ad-hoc manner and callers had to make sure to set both lest they leave invalid ASTs in an inconsistent state. We even went so far as to teach the constraint solver to reset the invalid bit when it was unwinding which meant we had to track every singleValueDecl
.Instead, make this predicate ask for the interface type. The setter now handles setting the interface type as well. A lot of cleanup falls out of this one change:
!getInterfaceType() || isInvalid()
dancesPossiblyInvalidDecls
setInvalid(); setInterfaceType(ErrorType::get())
variable 'x' is not bound by any pattern
because we're actually invalidating the AST correctly!A few places had to be patched up to break the new cycles this introduces, but serendipitously the cycle breaker in
getUnopenedTypeOfReference
appears to be unnecessary.