You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: Stroustrup bracket style in anonymous record type parameter is not respected #3069
I just updated from 6.2.3 to 6.3.0. Suddenly all my anonymous record type parameters are using aligned style even though I have configured Stroustrup style.
Extra information
The formatted result breaks my code.
The formatted result gives compiler warnings.
I or my company would be willing to help fix this.
I would like a release if this problem is solved.
Options
Fantomas main branch at 2024-03-18T09:36:28Z - 74fb395
{ config with
MultilineBracketStyle = stroustrup }
Did you know that you can ignore files when formatting by using a .fantomasignore file? PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
So for MultilineBracketStyle = Stroustrup, the anonymous record type gets the same formatting as Aligned.
What the fix would involve
The Stroustrup expectation for a type application with an anonymous record argument would be that the {| opens on the same line as <, with fields indented and |}> closing naturally:
colGenericTypeParameters to detect when MultilineBracketStyle = Stroustrup and keep the first argument on the same line (instead of indentSepNlnUnindent)
OR the > handling in Type.AppPrefix to be Stroustrup-aware
This is non-trivial because it touches the interaction between how generic type argument lists and anonymous record types are independently formatted. A fix would need to be carefully coordinated between Type.AppPrefix and Type.AnonRecord to avoid producing parse errors or misaligned output.
I'm flagging this for maintainer attention — it's a genuine regression that would benefit from a targeted fix.
Activity
github-actions commentedon Mar 2, 2026
🤖 This is an automated response from Repo Assist.
I investigated the root cause of this regression. The issue lies in two interacting parts of
CodePrinter.fs.Root Cause
1.
colGenericTypeParameters(line ~2362) ignoresMultilineBracketStyleWhen a generic type like
convertTo<{| ... |}>needs to span multiple lines,colGenericTypeParametersalways uses the "aligned" long form:This unconditionally places the type arguments on the next line with an indent, giving:
There is no Stroustrup-aware path here — the type parameter is always indented to a new line when multiline.
2.
Type.AnonRecordlong-form usesifAlignOrStroustrupBracketswhich treats Aligned and Stroustrup identicallyifAlignOrStroustrupBrackets (genStruct +> sepOpenAnonRecdFixed +> indentSepNlnUnindent (atCurrentColumnIndent genAnonRecordFields) +> sepNln +> genSingleTextNode node.Closing) // Aligned AND Stroustrup: same output (genStruct +> genOpening +> atCurrentColumn genAnonRecordFields ... +> genSingleTextNode node.Closing) // CrampedSo for
MultilineBracketStyle = Stroustrup, the anonymous record type gets the same formatting asAligned.What the fix would involve
The Stroustrup expectation for a type application with an anonymous record argument would be that the
{|opens on the same line as<, with fields indented and|}>closing naturally:This would require:
colGenericTypeParametersto detect whenMultilineBracketStyle = Stroustrupand keep the first argument on the same line (instead ofindentSepNlnUnindent)>handling inType.AppPrefixto be Stroustrup-awareThis is non-trivial because it touches the interaction between how generic type argument lists and anonymous record types are independently formatted. A fix would need to be carefully coordinated between
Type.AppPrefixandType.AnonRecordto avoid producing parse errors or misaligned output.I'm flagging this for maintainer attention — it's a genuine regression that would benefit from a targeted fix.
fix: Stroustrup bracket style now respected for single AnonRecord typ…
Keep Stroustrup anonymous-record type arguments attached
Keep a single anonymous record type argument attached in Stroustrup