Skip to content

Commit a80a633

Browse files
committed
FavourStaticEmptyFields: apply fix
Fix in FavourStaticEmptyFields rule for empty list of fields in records.
1 parent af741a1 commit a80a633

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/FSharpLint.Core/Rules/Conventions/FavourStaticEmptyFields.fs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ let private runner (args: AstNodeRuleParams) =
3939
let emptyLiteralType =
4040
if isArray then EmptyArrayLiteral else EmptyListLiteral
4141
generateError range emptyLiteralType
42+
| AstNode.Expression(SynExpr.Record(_, _, synExprRecordField, _)) ->
43+
synExprRecordField
44+
|> List.map (fun field ->
45+
match field with
46+
| SynExprRecordField(_, _, expr, _) ->
47+
match expr with
48+
| Some(SynExpr.ArrayOrList(isArray, [], range)) ->
49+
let emptyLiteralType = if isArray then EmptyArrayLiteral else EmptyListLiteral
50+
generateError range emptyLiteralType
51+
| _ -> Array.empty)
52+
|> Array.concat
4253
| _ -> Array.empty
4354

4455

0 commit comments

Comments
 (0)