Skip to content

[CSBindings] Optional object type variable should be connected to the optional #73960

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
May 29, 2024

Conversation

xedin
Copy link
Contributor

@xedin xedin commented May 28, 2024

If both sides of an OptionalObject constraint are un-inferred, their
binding sets need to correctly reflect adjacency - a type variable
that represents optional would get "object" as an adjacency through
its potential binding (the binding is - "object" wrapped in a single
level of optional) and "object" type variable needs to get its parent
optional type variable added to its adjacency list explicitly.

Without this it would be possible to prematurely pick "object" before
its parent optional type variable.

Resolves: #73207
Resolves: rdar://126960579

xedin added 2 commits May 28, 2024 15:45
… optional

If both sides of an `OptionalObject` constraint are un-inferred, their
binding sets need to correctly reflect adjacency - a type variable
that represents optional would get "object" as an adjacency through
its potential binding (the binding is - "object" wrapped in a single
level of optional) and "object" type variable needs to get its parent
optional type variable added to its adjacency list explicitly.
Without this it would be possible to prematurely pick "object" before
its parent optional type variable.

Resolves: swiftlang#73207
Resolves: rdar://126960579
If the contextual type propagated into the optional chain mismatches with
the inner type formed from its member references and that inner type
is a result of some fix, let's consider that un-salvageable and avoid
producing additional "ignore contextual type" fixes which only lead
to subpar solutions.
@xedin xedin requested a review from hborla as a code owner May 28, 2024 22:58
@xedin
Copy link
Contributor Author

xedin commented May 28, 2024

@swift-ci please test

@xedin xedin merged commit 45a299a into swiftlang:main May 29, 2024
5 checks passed
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.

(type checker) regression on main in subtyping rules for tuple labels
2 participants