Skip to content

Commit

Permalink
brilck: Error when @main has a return type
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Sep 8, 2023
1 parent 4652a8f commit 19ad341
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions brilck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ function checkProg(prog: bril.Program) {
// Check each function.
for (let func of prog.functions) {
checkFunc(funcEnv, func);

// The @main function must not return anything.
if (func.name === 'main') {
if (func.type) {
err(`@main must have no return type; found ${typeFmt(func.type)}`,
func.pos);
}
}
}
}

Expand Down

0 comments on commit 19ad341

Please sign in to comment.