Skip to content

[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

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

hborla
Copy link
Member

@hborla hborla commented Jun 28, 2022

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

@hborla hborla requested a review from DougGregor June 28, 2022 01:06
@hborla
Copy link
Member Author

hborla commented Jun 28, 2022

@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?) { }
Copy link
Contributor

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?

Copy link
Member Author

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.
@hborla
Copy link
Member Author

hborla commented Jun 29, 2022

@swift-ci please smoke test

@hborla hborla assigned xedin and unassigned xedin Jun 29, 2022
@hborla hborla requested a review from xedin June 29, 2022 19:41
// 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);
Copy link
Contributor

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

Copy link
Member

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.

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.

4 participants