google / google/xls

Formatter can't handle inline comments on proc instantiation parametrics

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

Description

**Describe the bug**
The formatter complains that the comment would be deleted if you try to add comments to proc instantiation parametric values.

```
Formatting failed: Error: INTERNAL: Formatting was skipped because a comment at xls/examples/ram.x:495:17-496:1 would be deleted by the formatter: // DATA_WIDTH
This is probably due to a bug (which may not have been reported yet). To complete formatting, try moving the comment to a different line.
=== Source Location Trace: ===
xls/dslx/fmt/ast_fmt.cc:3035
xls/dslx/fmt/ast_fmt.cc:3052
xls/dslx/dslx_fmt.cc:105
xls/dslx/dslx_fmt.cc:206
```

**To Reproduce**
Try to format:

https://github.com/google/xls/blob/c3f15d6c583b5cd136c38e972b86889a6ac2c88a/xls/examples/ram.x#L309-L314

**Expected behavior**
Formatter should handle this, preserving the comments.

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.