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

Properly tag observable enums #2786

Merged
merged 5 commits into from Feb 8, 2024
Merged

Properly tag observable enums #2786

merged 5 commits into from Feb 8, 2024

Conversation

stephencelis
Copy link
Member

@stephencelis stephencelis commented Feb 8, 2024

It's possible for nested, inert enums to have the same "tag" and thus identity when they are distinct structures, which prevents cases changes from being observed. Let's allow tagging to happen recursively, which will allow for distinct identity in these cases.

private var storage: Storage

@usableFromInline
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Losing the inlinability here, but think it's fine.

@@ -72,9 +62,8 @@

public static let _$inert = Self()

@inlinable
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Losing the inlinability here, but think it's fine.

@inlinable
public func _$tag(_ tag: Int?) -> Self {
Self(location: self.location, tag: tag)
public func _$tag(_ tag: Int) -> Self {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight API change here, but couldn't find an instance where nil was being passed.

@stephencelis stephencelis merged commit 71c82d7 into main Feb 8, 2024
7 checks passed
@stephencelis stephencelis deleted the enum-id-fix branch February 8, 2024 22:54
cgrindel-self-hosted-renovate bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Feb 13, 2024
…ure to from: "1.8.0" (#914)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[pointfreeco/swift-composable-architecture](https://togithub.com/pointfreeco/swift-composable-architecture)
| minor | `from: "1.7.3"` -> `from: "1.8.0"` |

---

### Release Notes

<details>
<summary>pointfreeco/swift-composable-architecture
(pointfreeco/swift-composable-architecture)</summary>

###
[`v1.8.0`](https://togithub.com/pointfreeco/swift-composable-architecture/releases/tag/1.8.0)

[Compare
Source](https://togithub.com/pointfreeco/swift-composable-architecture/compare/1.7.3...1.8.0)

#### What's Changed

- Added: New `@Reducer` macro features
([pointfreeco/swift-composable-architecture#2795).

The `@Reducer` macro has been enhanced to streamline usage and simplify
some common patterns:

- When left undefined, the `@Reducer` will now define default
implementations of `State`, `Action`, and `body`. This means stubbing a
feature is as simple as `@Reducer struct Feature {}`.

- `@Reducer` can now be used with enums to simplify the boilerplate
associated with "destination" and "path" reducers.

See the [1.8 migration
guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.8)
for more information on how to use these APIs.

- Fixed: Propagate `@ViewAction` macro availability
([pointfreeco/swift-composable-architecture#2785).

- Fixed: Properly tag nested observable enums so that changes to
non-observable cases are better observed
([pointfreeco/swift-composable-architecture#2786).

- Infrastructure: Fix typo in migration guide 1.6 (thanks
[@&#8203;takehilo](https://togithub.com/takehilo),
[pointfreeco/swift-composable-architecture#2779);
better document explicit `id` with scoped `ForEach`
([pointfreeco/swift-composable-architecture#2784);
Fix typo in the 1.7 migration guide (thanks
[@&#8203;yaslab](https://togithub.com/yaslab),
[pointfreeco/swift-composable-architecture#2780;
thanks [@&#8203;Ryu0118](https://togithub.com/Ryu0118),
[pointfreeco/swift-composable-architecture#2790);

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.7.2...1.8.0

#### New Contributors

- [@&#8203;yaslab](https://togithub.com/yaslab) made their first
contribution in
[pointfreeco/swift-composable-architecture#2780

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.7.3...1.8.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
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.

None yet

2 participants