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 authored and Pat-Lafon committed Sep 9, 2023
1 parent 1207cb2 commit f03c53e
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 f03c53e

Please sign in to comment.