Skip to content

Remove the complete inactive private async function during target filtering #950

Closed

Description

@LunaStev

Problem

Target filtering recognizes fun and pub, but omits the existing async fun declaration prefix. For a private multiline async function on an inactive target, preprocessing removes only the signature line and leaves the body at top level. A declaration that should be excluded then breaks parsing.

Starting points: recognized declaration starts and the inactive-item preprocessing branch.

Reproduction

Executed at d59bdab376bdc04edacdc8029b256cb8d55b5adf on Linux amd64 using the checkout-built compiler (0.0.1-alpha-dev, Rust 1.89.0 and LLVM 21.1.8).

#[target(os="windows")]
async fun windows_only() {
    return;
}
fun main() {}
target/debug/wavec check repro.wave --target=x86_64-unknown-linux-gnu --error-format=json

Observed exit 1, E2001 at line 3 column 5: unexpected token at top level, found Return. The entire Windows function should be excluded. Replacing the declaration prefix with pub async fun passes; an included Linux async fun also passes check.

Scope

Recognize the existing private async declaration as a complete target-controlled item. Preserve body/comment nesting, byte positions and logical newlines. This does not implement async LLVM lowering or change target-condition syntax.

Related #441 introduced async fun wherever an ordinary function declaration is valid. #645 and #729 cover separate comment-state cases around target attributes.

Difficulty: easy; a bounded declaration-recognition regression using the existing item consumer.

Completion criteria

  • Inactive private async functions are removed through their closing brace, including nested bodies.
  • Included private/public async and existing ordinary declarations retain their check/AST behavior.
  • LF/CRLF/CR cases preserve source positions and later diagnostics.

Activity

  1. added
    bug
    good first issue
    on Oct 18, 2026
  2. added a commit that references this issue on Oct 21, 2026
    42b65e4
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

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions