{.Keep multiline inline records in exception and constructor declarations
๐ Bug fixsyntaxprintertests
The formatter keeps an inline record of an exception, a variant constructor or an extension constructor multiline when its first field starts on a later line than the constructor name, as it already does for record type declarations. Before, such inline records were joined onto one line whenever they fit.
Example ReScript
exception Foo({ name: string, msg: string,})
exception Foo({name: string, msg: string})exception Foo({ name: string, msg: string,})
๐ Bug fixKeep inline records in exception and constructor declarations multiline when the source has a line break after
Review
- Does this reformat existing code? Only inline records written with a line break after
{; reformatting packages/ and tests/ with res_parser changes no file.
- No effect
- Output: unchangedFormats: nonePPX: unchangedEditor: unchanged
- Formatting
- changedinline records in exception and constructor declarations written with a line break after
{stay multiline - Tests
- syntax
tests/syntax_tests/data/+ printer/typeDef/inlineRecordMultiline.res~ printer/typeDef/expected/variant.res.txt
- Changelog fragment changes/inline-record-multiline.fix.md
- No committed generated JS changes
5 files ยท +131 โ14 ยท changelog 1 ยท syntax 1 ยท tests 3
| A | changes/inline-record-multiline.fix.md | +1 | โ0 |
| M | compiler/syntax/src/res_printer.ml | +25 | โ13 |
| A | tests/syntax_tests/data/printer/typeDef/expected/inlineRecordMultiline.res.txt | +53 | โ0 |
| M | tests/syntax_tests/data/printer/typeDef/expected/variant.res.txt | +4 | โ1 |
| A | tests/syntax_tests/data/printer/typeDef/inlineRecordMultiline.res | +48 | โ0 |