syntax: Fix lambda parsing following 'ret'
This commit is contained in:
parent
45ccaf04c4
commit
3155d170ad
@ -198,6 +198,8 @@ pure fn can_begin_expr(t: token) -> bool {
|
||||
BINOP(MINUS) { true }
|
||||
BINOP(STAR) { true }
|
||||
BINOP(AND) { true }
|
||||
BINOP(OR) { true } // in lambda syntax
|
||||
OROR { true } // in lambda syntax
|
||||
MOD_SEP { true }
|
||||
_ { false }
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ fn f(i: int, f: fn(int) -> int) -> int { f(i) }
|
||||
|
||||
fn g(g: fn()) { }
|
||||
|
||||
fn ff() -> fn@(int) -> int {
|
||||
ret |x| x + 1;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert f(10, |a| a) == 10;
|
||||
g(||());
|
||||
@ -11,4 +15,5 @@ fn main() {
|
||||
do g() || { }
|
||||
let _x: fn@() -> int = || 10;
|
||||
let _y: fn@(int) -> int = |a| a;
|
||||
assert ff()(10) == 11;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user