Skip to content

Allow grouped void calls in Whale expression statements #877

Closed

Description

@LunaStev

Problem

Grouping changes whether a supported void call can be used as a statement. noop(); succeeds; (noop()); returns a non-scalar-expression error. The call result is discarded in both cases. Returning a void call from a void function also fails through the same scalar-only expression path.

Reproduction

At fd07427f4a976de05e38eff3ee1760db97fbb761 on Linux amd64 with Rust 1.89 and locked Whale 020d2a4, lexing, parsing and TypedProgram lowering succeed, but calling whale::emit_ir on this source returns Whale backend does not yet support non-scalar expressions:

fun noop() {} fun main() -> i32 { (noop()); return 0; }

Removing only the call parentheses passes in the same direct-adapter reproduction.

Additional CLI reproduction on 2026-10-09 at 53bb5809cf32d29f5a5a9d313ffa332ea3cd4beb (tree identical to canonical master c5ab63f9eec388c75b00f5cd59eae28a45a9b39f):

fun nope() {}
fun main() { return nope(); }

wavec check return_void.wave exits 0; wavec --whale check return_void.wave --error-format=json exits 1 with Whale backend does not yet support non-scalar expressions, pointing at nope(). This was executed on Linux amd64 with the source-built compiler and locked Whale 020d2a4. The call should execute once followed by a void return; it is not a numeric value context.

Scope

Fix the effect-expression path in whale/src/codegen/expression.rs and the void return path in whale/src/codegen/mod.rs, without allowing void values in numeric contexts. Difficulty: easy.

Completion criteria

  • Accept nested grouped void calls used solely for effects.
  • Accept a void-call return expression in a void function, executing the call once and returning without a value.
  • Retain errors for void calls in numeric or non-void value contexts.
  • Add a regression proving the call is lowered once.

Activity

  1. added
    bug
    good first issue
    on Oct 7, 2026
  2. self-assigned this
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions