-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[LangOptions] Remove the option to enable/disable implicit existential opening. #59740
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
[LangOptions] Remove the option to enable/disable implicit existential opening. #59740
Conversation
@swift-ci please smoke test |
@@ -8,14 +8,14 @@ protocol CP : class { } | |||
static func createNewOne() -> SP | |||
} | |||
|
|||
func fP<T : P>(_ t: T) { } | |||
func fP<T : P>(_ t: T?) { } |
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.
Is the addition of '?' in this file intentional?
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.
Yes, I made these parameters optional so the diagnostics stay the same later in the file (instead of disappearing due to opening)
in code completion to avoid sending a pre-type-checked AST through the constraint system.
@swift-ci please smoke test |
// Use a placeholder expr for the LHS argument to avoid sending | ||
// a pre-type-checked AST through the constraint system. | ||
OpaqueValueExpr argExpr(LHS->getSourceRange(), LHSTy, | ||
/*isPlaceholder=*/true); |
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.
Make sense to me! If I understand correctly, code completion doesn't care about the structure of the argument but the fact that the argument has a particular type it could use to infer right-hand side of the operator.
/cc @ahoppen
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.
Yes, we only care about the type. We might even be able to get rid of the ConstraintSystemFlags::ReusePrecheckedType
option above. Not entirely sure though.
This feature has been accepted in Swift evolution, so there's no need to have a flag to enable/disable it. This also fixes an issue where the feature was not enabled by default in LLDB.
This change also uses opaque value placeholders where code completion was previously sending a pre-type-checked AST through the constraint system, which tripped an assertion during
shouldOpenExistentialCallArgument
when looking up types for AST nodes that should have been cached in the constraint system.Resolves: rdar://94730905