mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Fix #1021 - Optional or
branch doesn't define err
This commit is contained in:

committed by
Alexander Medvednikov

parent
8a2d25247f
commit
af19aa5096
10
compiler/tests/option_test.v
Normal file
10
compiler/tests/option_test.v
Normal file
@@ -0,0 +1,10 @@
|
||||
fn opt_err() ?string {return error('hi')}
|
||||
|
||||
fn test_err(){
|
||||
v := opt_err() or {
|
||||
assert err == 'hi'
|
||||
return
|
||||
}
|
||||
assert false
|
||||
println(v) // suppress not used error
|
||||
}
|
Reference in New Issue
Block a user