do not allow fn main() to return a value

pull/1011/head
Alexander Medvednikov 2019-07-05 22:03:00 +02:00
parent d47e2f113f
commit 871fb3831a
1 changed files with 1 additions and 1 deletions

View File

@ -261,7 +261,7 @@ fn (p mut Parser) fn_decl() {
// println('FN DECL $f.name typ=$f.typ str_args="$str_args"') // println('FN DECL $f.name typ=$f.typ str_args="$str_args"')
// Special case for main() args // Special case for main() args
if f.name == 'main' && !has_receiver { if f.name == 'main' && !has_receiver {
if str_args != '' { if str_args != '' || typ != 'void' {
p.error('fn main must have no arguments and no return values') p.error('fn main must have no arguments and no return values')
} }
typ = 'int' typ = 'int'