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 adds unnecessary parentheses to array index

hongted opened this issue · comments

Consider:

pub struct B {
  value: u32,
}

pub struct A {
   value: B[5],
}

pub fn f(A) -> A {
  if A.B[0] == u32:0 {
    zero!<A>()
  } else {
    A
  } 
}

dslx_fmt formats it to

pub struct B { value: u32 }

pub struct A { value: B[5] }

pub fn f(a: A) -> A { if (a.B[0]).value == u32:0 { zero!<A>() } else { a } }

Note extra parentheses around a.B[0]