wavefnd / wavefnd/Wave

Reject unsupported parameterized main signatures before code generation

Open
#452 0 comments 0 reactions 0 assignees View on GitHub
bug good first issue needs testing
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 22m
Merged PRs (30d)
46

Description

## 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.

```wave
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.

Contributor guide

Open the contributing guide

Research direction

Trace how entry-point main functions are validated before LLVM code generation, then inspect tests/cases/test12.wave and test26.wave for parameter and default-argument coverage. Check hosted, freestanding, and WASI entry modes where applicable. Done means parameterized main receives a clear diagnostic, while zero-parameter forms remain valid and default-parameter syntax is covered independently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.