google / xls

XLS: Accelerated HW Synthesis

Home Page:http://google.github.io/xls/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dslx_fmt removes comment in return line if that is a unary expression

hzeller opened this issue · comments

Consider this input:

$BUILD_PATH/xls/dslx/dslx_fmt /dev/stdin << EOF
fn foo(x: u32) -> u32 {
   !x  // trivial expression
}
EOF

The comment in the line is removed:

fn foo(x: u32) -> u32 {
    !x
}

Interestingly, this does not happen if the return value is just x or a binary x + x expression; the unary !x expression seems to trigger this.