30 lines
454 B
V
30 lines
454 B
V
// a prefix op can be parsed as an infix op if there's an expression on the line before
|
|
// https://github.com/vlang/v/pull/6491
|
|
fn test_prefix() {
|
|
mut v := 1
|
|
mut p := &v
|
|
// OK, special workaround
|
|
unsafe {
|
|
v = 1
|
|
*p = 2
|
|
}
|
|
|
|
// later this should compile correctly
|
|
_ = if true {
|
|
v = 1
|
|
-1
|
|
} else {1}
|
|
_ = p
|
|
}
|
|
|
|
fn opt() ?&int {return none}
|
|
|
|
fn test_prefix_or() {
|
|
// later this should compile correctly
|
|
v := 3
|
|
_ = opt() or {
|
|
_ = 1
|
|
&v
|
|
}
|
|
}
|