Skip to content

Tests: tuple await coverage (§14) #534

Closed

Description

@ehartford

Summary

Add missing negative coverage for tuple .await arity. The compiler already checks tuple await arity 2..12 and task element types, and positive tuple-await tests exist. This issue pins the arity diagnostics so tuple await does not silently accept invalid singletons or oversized tuples.

Spec

§14.11 says tuple .await supports tuple sizes 2 through 12. Tuple .await awaits all tasks and returns a tuple of their results.

let pair = (a(), b()).await       // ok
let one = (a()).await             // error/not tuple await
let too_many = (...13 tasks...).await  // error

Current state

Sema checks tuple await in the NK_AWAIT branch. If the awaited inner expression is a tuple, it rejects element counts less than 2 or greater than 12 with await tuple requires between 2 and 12 tasks (src/SemaCheck.w:3178, src/SemaCheck.w:3181) and rejects non-task elements (src/SemaCheck.w:3183). MIR lowering then lowers tuple await by lowering all tasks first, awaiting each, and building a result tuple (src/MirLower.w:8443, src/MirLower.w:8457).

Positive coverage exists in test/spec/spec_ss14_async_await.w:21 and test/behavior/async_tuple_await.w:14, but arity negatives are missing.

Implementation plan

  1. Add test/compile_errors/err_tuple_await_too_many.w with 13 tasks and //! expect-error: await tuple requires between 2 and 12 tasks.
  2. Add test/compile_errors/err_tuple_await_non_task_element.w if not already present, with a tuple mixing a task and plain integer.
  3. For singleton syntax, verify parser behavior first: (task) is grouped expression, not a tuple, so .await should follow ordinary single-task await. If the language has a one-element tuple spelling, add a specific negative for that spelling.
  4. Keep positive tests for arities 2 and 12 to prove the boundary.

Test plan

Add compile-error fixtures listed above. Extend test/spec/spec_ss14_async_await.w or a new test/spec/spec_ss14_11_tuple_await_arity.w with a 12-task positive boundary if practical.

Acceptance criteria

  • Tuple await arity > 12 is covered by a compile-error test.
  • Non-task tuple element rejection is covered if not already.
  • Boundary positive coverage includes arity 2 and ideally arity 12.
  • 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.11.1.8.

Activity

  1. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    Closing — await tuple 13-task and non-task-element rejections pinned by err_await_tuple_too_many / err_await_tuple_nontask (13f4f88); arity-2 positive already covered by async_tuple_await / spec_ss14_async_await. §14.

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