Skip to content

Bug: Task.is_done() on Task parameters fails MIR/codegen lowering #569

Closed

Description

@ehartford

Summary

Calling Task.is_done() on a Task[T] function parameter reaches MIR/codegen as an unhandled MirIntrinsic.GENERIC_CALL instead of lowering to the Task surface intrinsic. The same expression shape matters for §14.7 Task methods and for §14.22 task-disposition proofs.

Minimal reproduction

async fn work -> i32: 1

fn done(t: Task[i32]) -> bool:
    t.is_done()

fn main:
    let t = work()
    assert(not done(t))

Run with the project compiler:

./out/release/bin/with -e 'async fn work -> i32: 1
fn done(t: Task[i32]) -> bool:
    t.is_done()
fn main:
    let t = work()
    assert(not done(t))'

Actual

FATAL: unhandled MirIntrinsic.GENERIC_CALL sym=is_done node_kind=27 recv_ty=304 recv_kind=24 arg_count=1
error: code generation failed

Expected

Task.is_done() should lower for Task[T] parameters the same way it lowers for other Task values, or Sema should fail loudly earlier with a targeted diagnostic if some receiver form is unsupported. It must not reach a fatal generic-call backend path.

Notes

Found while implementing #355. The #355 tests avoid is_done() so the ephemeral-task escape fix stays scoped, but this bug should be fixed rather than worked around permanently.

Activity

  1. ehartford commented on Jul 2, 2026

    @ehartford
    ContributorAuthor

    Closing as fixed on HEAD (verified by probe): Task.is_done() on Task[T] parameters checks and runs, exit 0 (§14.7/§14.22). The FATAL GENERIC_CALL for sym=is_done is gone.

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