Skip to content
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

Add case path iteration #159

Merged
merged 14 commits into from
Jun 6, 2024
Merged

Add case path iteration #159

merged 14 commits into from
Jun 6, 2024

Conversation

stephencelis
Copy link
Member

This wasn't so bad to add on top of #158.

I made it so that AllCasePaths: Sequence so that you could iterate over all of the case paths.

The biggest issue is this conformance confuses autocompletion of case key paths with a few properties that come with Sequence:

image

They show up at the end, so it's not so bad. I avoided a RandomAccessCollection conformance because it added even more pollution here.

Alternately:

  1. We could spell out a whole separate object that acts as the collection, though not sure what that would look like.
  2. If/when we add some kind of conformance to AllCasePaths, like CasePathCollection, then we could squirrel away the collection stuff to a RangeReplaceableCollection.init(some CasePathCollection) helper instead.

Base automatically changed from case-path-lookup to main May 31, 2024 03:12
@stephencelis stephencelis merged commit 59f98d2 into main Jun 6, 2024
4 checks passed
@stephencelis stephencelis deleted the case-path-iteration branch June 6, 2024 14:56
@stephencelis stephencelis restored the case-path-iteration branch June 6, 2024 22:32
@stephencelis
Copy link
Member Author

(Restored the branch for swiftlang/swift#74107)

stephencelis added a commit that referenced this pull request Jun 19, 2024
While the macro recently introduced iteration (#159) and "reflection"
(#158), there's no way to abstract over it. Adding it directly to the
`CasePathable` protocol would be potentially source breaking, so instead
we can introduce some new protocols.
stephencelis added a commit that referenced this pull request Jul 12, 2024
* Add `CasePathIterable` and `CasePathReflectable` protocols

While the macro recently introduced iteration (#159) and "reflection"
(#158), there's no way to abstract over it. Adding it directly to the
`CasePathable` protocol would be potentially source breaking, so instead
we can introduce some new protocols.

* wip

* wip

* wip
@stephencelis stephencelis deleted the case-path-iteration branch August 7, 2024 21:02
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