Skip to content

Reject unsupported parameterized main signatures before code generation #452

Closed

Description

@LunaStev

Problem

Wave currently accepts parameterized main functions even though hosted entry trampolines invoke main using the C int main ABI and do not supply Wave default arguments.

fun main(value: i32 = 42) -> i32 {
    return value;
}

This program compiles, but its process result is not 42; the generated function signature and the runtime entry contract disagree.

Scope

  • Add a semantic check requiring an entry-point main to have zero parameters.
  • Produce a clear source diagnostic before LLVM code generation.
  • Move parameter/default-argument grammar coverage in tests/cases/test12.wave and test26.wave to helper functions or parser-focused fixtures.
  • Cover hosted, freestanding, and WASI entry modes where applicable.

Designing a future explicit argc/argv entry contract is out of scope.

Acceptance criteria

  • A parameterized main is rejected consistently with an actionable diagnostic.
  • Zero-parameter fun main() and fun main() -> i32 remain valid.
  • Default-parameter syntax remains covered independently of entry-point semantics.

Activity

  1. added
    bug
    good first issue
    needs testing
    on Sep 3, 2026
  2. self-assigned this
    on Sep 25, 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 issueneeds testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions