google / google/xls

[DSLX fmt] closing curly indented too much

Open
#2,302 0 comments 0 reactions 0 assignees View on GitHub
dslx:fmt fmt:whitespace
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

**Describe the bug**
Formatter indents a closing curly too much.

**To Reproduce**
Start with this code, run format.
```
fn foo(src: float32::F32) -> u32 {
let long_name_long_name_long_name_long_name_long_name_long_name_long_name = true;
match float32::tag(src) {
float32::FloatTag::NAN => u32:0,
float32::FloatTag::INFINITY => u32:0,
float32::FloatTag::ZERO => u32:0,
float32::FloatTag::SUBNORMAL => u32:0,
float32::FloatTag::NORMAL => {
if long_name_long_name_long_name_long_name_long_name_long_name_long_name {
u32:0
} else {
u32:0
}
},
}
}
```

It will move the third from last curly:
```
float32::FloatTag::NORMAL => {
if long_name_long_name_long_name_long_name_long_name_long_name_long_name {
u32:0
} else {
u32:0
}
},
}
}
```

**Expected behavior**
It should not indent that curly. It should not change the input source code, it's already formatted correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.