-
Notifications
You must be signed in to change notification settings - Fork 226
dslx parse error on expressions with inline for #3967
Copy link
Copy link
Open
Labels
bugSomething isn't working or is incorrectSomething isn't working or is incorrectdslxDSLX (domain specific language) implementation / front-endDSLX (domain specific language) implementation / front-end
Description
Describe the bug
0003: fn foo(arg: bits[9]) -> bool {
0004: let p = arg[8 +: u1];
0005: p ^ for (i, acc) in u32:0..u32:8 {
~~~~~~~~~~~~~~^-^ ParseError: Expected start of an expression; got: keyword:for
0006: arg[i+:u1] ^ acc
0007: }(u1:1)
To Reproduce
fn foo(arg: bits[9]) -> bool {
let p = arg[8 +: u1];
p ^ for (i, acc) in u32:0..u32:8 {
arg[i+:u1] ^ acc
}(u1:1)
}
Expected behavior
expressions with an inline for are valid.
Workaround
Use a separate let binding:
fn foo(arg: bits[9]) -> bool {
let p = arg[8 +: u1];
let f = for (i, acc) in u32:0..u32:8 {
arg[i+:u1] ^ acc
}(u1:1);
p ^ f
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't working or is incorrectSomething isn't working or is incorrectdslxDSLX (domain specific language) implementation / front-endDSLX (domain specific language) implementation / front-end
Type
Projects
Status
No status