v.eval: show `sumtype or interface casts return void currently` only with -v

pull/12802/head
Delyan Angelov 2021-12-11 23:45:54 +02:00
parent 23be53e2de
commit adf353702e
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 4 additions and 2 deletions

View File

@ -380,8 +380,10 @@ pub fn (mut e Eval) expr(expr ast.Expr, expecting ast.Type) Object {
}
}
} else if e.table.get_type_symbol(expr.typ).kind in [.interface_, .sum_type] {
if e.pref.is_verbose {
eprintln(util.formatted_error('warning:', 'sumtype or interface casts return void currently',
e.cur_file, expr.pos))
}
} else {
e.error('unknown cast: ${e.table.get_type_symbol(expr.expr_type).str()} to ${e.table.get_type_symbol(expr.typ).str()}')
}