Skip to content

Tests: ss14 9 scope coverage (§14) #525

Closed

Description

@ehartford

Summary

Add missing coverage that scope / async scope forms are available in no-runtime/no-std contexts according to the §14.9 rule boundaries. Existing tests cover scoped tasks and OS-thread scopes, but not the negative/positive no-runtime split. This prevents regressions where scope syntax becomes accidentally tied to the fiber runtime.

Spec

§14.9 says scope supports inline, colon, and braced body forms and is available in no-runtime contexts where the body does not require fibers. Async scopes, by contrast, require the fiber runtime because cleanup awaits tracked tasks.

Current state

Sema handles sync scope and async async scope separately. Async scope requires the runtime (src/SemaCheck.w:3298 from the require_async_runtime call family), while ordinary scope has worker capture and escape checks around the sync-scope path (src/SemaCheck.w:3340). Existing tests cover block forms and scoped task tracking (test/behavior/behav_scope_block_forms.w, test/spec/spec_ss14_8_scoped_task_tracking.w), but not no-runtime scope availability.

Implementation plan

  1. Add a no-runtime positive test for ordinary scope with inline, colon, and braced bodies that uses only core operations.
  2. Add a no-runtime negative test for async scope, expecting async scope requires the fiber runtime.
  3. Ensure the positive test runs with //! args: --no-runtime or the existing harness directive form. If no_std is part of the requirement, include --no-std plus required panic/entry boilerplate.
  4. Keep OS-thread s.spawn out of the no-runtime positive unless §14 says OS threads are available for that target; this issue is about scope syntax/body forms, not thread spawn.

Test plan

Add:

  • test/spec/spec_ss14_9_scope_no_runtime.w with //! args: --no-runtime and ordinary scope forms;
  • test/compile_errors/err_async_scope_no_runtime.w with //! expect-error: async scope requires the fiber runtime.

Run existing scope tests as regression coverage.

Acceptance criteria

  • Ordinary scope body forms are tested under no-runtime where valid.
  • Async scope remains rejected without the fiber runtime.
  • Tests clarify the boundary between lexical scope and async structured concurrency.
  • with build && with build :fixpoint && with build :test pass.

Dependencies

None.

Traceability

From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 14.9.1.23.

Activity

  1. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    Closing — ordinary scope under --no-runtime (spec_ss14_9_scope_no_runtime) + async scope rejected under --no-runtime (err_async_scope_no_runtime), pinned 13f4f88. §14.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions