Fix missing await and syntax errors in documentation examples - #3953
Open
meliharik wants to merge 1 commit into
Open
Fix missing await and syntax errors in documentation examples#3953meliharik wants to merge 1 commit into
meliharik wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups to the same classes of documentation bug fixed in #3940, #3936 and #3939 — I found remaining instances in other articles.
Missing
awaitonTestStore(13 lines)TestStore.sendandTestStore.receiveare bothasync, so these examples do not compile as written.TestingTCA.mdwas corrected in #3940; the same shape survives in three other articles, each inside a block that constructs aTestStore:Articles/Performance.md— 9 lines across the two "sharing logic" test examplesArticles/Bindings.md— 2 lines in the binding-action test exampleArticles/FAQ.md— 2 lines, in the paragraph that explicitly introducesTestStoreUnbalanced parentheses (2 lines)
Articles/MigrationGuides/MigratingTo1.10.md—@Shared(.fileStorage(URL(/* ... */) var signUpDatais missing two closing parens. This is the same typo Fix SharingState documentation example syntax #3936 fixed inSharingState.md; that file now reads@Shared(.fileStorage(URL(/* ... */))) var users, and this line now matches it.Articles/MigrationGuides/MigratingTo1.11.md— the#Preview { … }example closes with)instead of}.How I found them
I extracted all 362 ```swift blocks from the DocC sources and checked paren/bracket balance outside strings and comments, then cross-checked every
store.send/`store.receive` against whether its block builds a `TestStore`. Braces were deliberately not balance-checked, since the docs legitimately show fragments.Two things I deliberately left alone:
Articles/StackBasedNavigation.md:212also callsstore.send(.detailButtonTapped)withoutawait, but that one is inside a SwiftUIButtonand so is the synchronousStore.send— correct as written.Articles/MigrationGuides/MigratingTo1.15.md:38has an unbalanced]), but it reads as an intentional excerpt from the middle of a.target(…)call rather than a typo. Happy to adjust if you'd prefer it balanced.I did not touch the
store.receivecalls in the 1.4 and 1.9 migration guides, since those are illustrating an older API era and it wasn't obvious whether you want them modernized.