gen: add panic message when using '?' with `none` (#6919)

pull/6926/head
Nick Treleaven 2020-11-23 15:16:38 +00:00 committed by GitHub
parent 96539e43b5
commit 380e3640e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -5196,7 +5196,7 @@ fn (mut g Gen) or_block(var_name string, or_block ast.OrExpr, return_type table.
paline, pafile, pamod, pafn := g.panic_debug_info(or_block.pos) paline, pafile, pamod, pafn := g.panic_debug_info(or_block.pos)
g.writeln('panic_debug($paline, tos3("$pafile"), tos3("$pamod"), tos3("$pafn"), ${cvar_name}.v_error );') g.writeln('panic_debug($paline, tos3("$pafile"), tos3("$pamod"), tos3("$pafn"), ${cvar_name}.v_error );')
} else { } else {
g.writeln('\tv_panic(${cvar_name}.v_error);') g.writeln('\tv_panic(_STR("optional not set (%.*s\\000)", 2, ${cvar_name}.v_error));')
} }
} else { } else {
// In ordinary functions, `opt()?` call is sugar for: // In ordinary functions, `opt()?` call is sugar for: