Cannot disable formatting around a field in a `struct` definition
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
**Describe the bug**
If you try to disable formatting around a "type" the formatter crashes.
**To Reproduce**
Steps to reproduce the behavior:
Try to format this:
```
struct Point {
// dslx-fmt::off
x: u32,
// dslx-fmt::on
y: u32,
}
```
It segfaults:
```
F1202 08:05:30.335632 4899 logging.cc:62] assert.h assertion failed at third_party/xls/common/casts.h:59 in To xls::down_cast(From *) [To = xls::dslx::TypeAnnotation *, From = xls::dslx::AstNode]: f == nullptr || dynamic_cast(f) != nullptr
*** Check failure stack trace: ***
@ 0x7f84ca3cd399 absl::log_internal::LogMessage::SendToLog()
@ 0x7f84ca3cc8ae absl::log_internal::LogMessage::Flush()
@ 0x7f84ca3cda19 absl::log_internal::LogMessageFatal::~LogMessageFatal()
@ 0x7f84db999574 __assert_fail
@ 0x7f8503270f63 xls::dslx::(anonymous namespace)::AstCloner::HandleStructDef()
```
Basically it's because `VerbatimNode` doesn't implement `TypeAnnotation`.
**Expected behavior**
Output = input
Contributor guide
Assessment
This issue has not been assessed yet.