fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

if expression is not indented

Open nojaf opened this issue 4 years ago • 1 comments

Issue created from fantomas-online

Code

            if 
              // Don't support implicit [<ReflectedDefinition>] on generated members, except the implicit members
              // for 'let' bound functions in classes.
              (not v.IsCompilerGenerated || v.IsIncrClassGeneratedMember) &&
              
              (// Check the attributes on any enclosing module
               env.reflect || 
               // Check the attributes on the value
               HasFSharpAttribute g g.attrib_ReflectedDefinitionAttribute v.Attribs ||
               // Also check the enclosing type for members - for historical reasons, in the TAST member values 
               // are stored in the entity that encloses the type, hence we will not have noticed the ReflectedDefinition
               // on the enclosing type at this point.
               HasFSharpAttribute g g.attrib_ReflectedDefinitionAttribute v.TopValDeclaringEntity.Attribs) then 

                ()

Result

if
// Don't support implicit [<ReflectedDefinition>] on generated members, except the implicit members
// for 'let' bound functions in classes.
(not v.IsCompilerGenerated
 || v.IsIncrClassGeneratedMember)
&&

(env.reflect // Check the attributes on any enclosing module
 ||
 // Check the attributes on the value
 HasFSharpAttribute g g.attrib_ReflectedDefinitionAttribute v.Attribs
 ||
 // Also check the enclosing type for members - for historical reasons, in the TAST member values
 // are stored in the entity that encloses the type, hence we will not have noticed the ReflectedDefinition
 // on the enclosing type at this point.
 HasFSharpAttribute g g.attrib_ReflectedDefinitionAttribute v.TopValDeclaringEntity.Attribs) then

    ()

Problem description

Should probably be something like:

if
    // Don't support implicit [<ReflectedDefinition>] on generated members, except the implicit members
    // for 'let' bound functions in classes.
    (not v.IsCompilerGenerated
     || v.IsIncrClassGeneratedMember)
    &&

    (env.reflect // Check the attributes on any enclosing module
     ||
    // Check the attributes on the value
     HasFSharpAttribute g g.attrib_ReflectedDefinitionAttribute v.Attribs
     ||
    // Also check the enclosing type for members - for historical reasons, in the TAST member values
    // are stored in the entity that encloses the type, hence we will not have noticed the ReflectedDefinition
    // on the enclosing type at this point.
     HasFSharpAttribute g g.attrib_ReflectedDefinitionAttribute v.TopValDeclaringEntity.Attribs) 
then

    ()

Extra information

  • [x] The formatted result breaks by code.
  • [ ] The formatted result gives compiler warnings.
  • [ ] I or my company would be willing to help fix this.

Options

Fantomas Master at 04/03/2021 14:38:21 - eebef38147f12abd67dea30c272e7c47abcfd229

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

nojaf avatar Apr 03 '21 18:04 nojaf

No longer ok. There is still a problem in env.reflect // Check the attributes on any enclosing module.

nojaf avatar May 13 '22 16:05 nojaf