Make very robust typing rules in docs/typing-rules-ja.md (source of truth) and docs/typing-rules-en.md (English translation):
- Explicit preconditions in each rule (type constraints, capability constraints, region constraints)
- Output context discipline: Every rule that consumes variables shows
⊣ Γ' - Cross-references between related rules
- Verification notes with
-emit-silrequirements where applicable
| Proposal | Title | Relevant Files |
|---|---|---|
| SE-0414 | Region-based isolation | swift/Sources/concurrency-type-check/RegionBasedIsolation.swift |
| SE-0430 | sending parameter and result values |
swift/Sources/concurrency-type-check/Sending.swift |
| SE-0431 | @isolated(any) function types |
swift/Tests/concurrency-type-checkTests/IsolatedAnyIsolationTests.swift |
| SE-0461 | Nonisolated nonsending by default | swift/Sources/concurrency-type-check/FuncConversionRules.swift |
Do NOT invent typing rules based on intuition or SE proposals alone — verify against actual Swift compiler behavior.
When adding/modifying typing rules in docs/typing-rules-ja.md (and propagating to docs/typing-rules-en.md):
- Add/update a corresponding minimal experiment under
swift/Sources/concurrency-type-check/(keep "positive" experiments always compiling under defaultswift build). - In the doc, add a
Verified in:list near the relevant rule, linking to the experiment file and the exact function name. - In the doc, also paste the extracted Swift snippet so the rule + PoC is self-contained.
- Verify with
swift build(notswiftc -typecheck), because region-based isolation diagnostics can be SIL-pass dependent. - For expected-error checks, gate code with
#if NEGATIVE_*and run:swift build -Xswiftc -D -Xswiftc NEGATIVE_*
Changes to typing rules touch five targets that must stay in sync:
| Target | Role |
|---|---|
docs/typing-rules-ja.md |
Source of truth (Japanese). Formal rules, definitions, verification references |
docs/typing-rules-en.md |
English translation — must be updated whenever -ja changes |
swift/Sources/concurrency-type-check/TypingRules.swift |
Swift experiments referenced by doc |
slide/src/swift-concurrency-type-system-slide.md |
Marp slide (KaTeX formulas) |
paper/sections/*.tex |
LaTeX paper (ACM format). Key sections: model.tex (judgment form, definitions), conversion-rules.tex (conversion analysis), kernel-rules.tex (typing rules), appendix-*.tex (full rule inventory) |
Use this flow by default for typing-rule changes:
- Update only
docs/typing-rules-ja.mdandswiftcode experiments. - Stop and ask for user approval/review of the
-jadiff. - After explicit approval, propagate to
docs/typing-rules-en.md,slide, andpaper. - Do not preemptively edit
docs/typing-rules-en.md, slide, or paper before that approval.
- Japanese doc is the source of truth. Make changes in
docs/typing-rules-ja.md(andswiftcode if needed) first. - Get approval on
-jadiff. Ask the user to review/approve before touching other files. - Translate to English. After approval, check diff to update
docs/typing-rules-en.mdto reflect the changes in-ja. - Propagate to slide. After approval, check diff to apply corresponding changes to the
slidemd. The slide uses KaTeX ($...$) while the doc uses plain-text notation — translate accordingly. - Propagate to paper. After approval, check diff to update the relevant LaTeX sections under
paper/sections/. The paper uses LaTeX math ($...$,\textsf{},\texttt{}) and custom macros frompreamble.sty. Key mapping: definitions/model →model.tex, conversion rules →conversion-rules.tex, typing rules →kernel-rules.tex, full rule inventory →appendix-full-typing-rules.tex, examples →appendix-examples.tex.