Skip to content

[TypeChecker] Improve performance of key path expression inference #70148

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Dec 1, 2023

  • Prefer key path type over a disjunction if key path is resolved

Binding key path type as soon as capability is known helps to propagate Value type to the context.

  • Prefer array literal type over a disjunction when it doesn't have any contextual bindings

Binding array literal type early helps to connect and propagate type information across its elements.

Resolves: rdar://118993030

…esolved

If key path type has bindings and is no longer delayed it means
that it's fully resolved and ready to be bound (even though value
type might not be resolved yet).
…ases

If array literal type is not delayed and doesn't have any type variables
associated with it, let's prefer it over a disjunction to facilitate
type propagation through its `Element` type to element expressions.

Resolves: rdar://118993030
@xedin
Copy link
Contributor Author

xedin commented Dec 1, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 1, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 1, 2023

@swift-ci please clean test macOS platform

@xedin xedin merged commit 86adc6f into swiftlang:main Dec 1, 2023
xedin added a commit to xedin/swift that referenced this pull request Dec 4, 2023
Follow-up to swiftlang#70148

Just like with arrays it's advantageous to favor dictionary
literals over disjunctions to bind the elements together and
enable inference across elements and, as a consequence,
type pruning.

Resolves: rdar://119040159
Catfish-Man pushed a commit to Catfish-Man/swift that referenced this pull request Jan 19, 2024
Follow-up to swiftlang#70148

Just like with arrays it's advantageous to favor dictionary
literals over disjunctions to bind the elements together and
enable inference across elements and, as a consequence,
type pruning.

Resolves: rdar://119040159
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.

2 participants