Skip to content

Conversation

@miniBill
Copy link
Contributor

@miniBill miniBill commented Oct 16, 2025

Fixes #336

Comment on lines +11989 to +11990
case Node.value lastArg of
Expression.ListExpr [ Node singleRange _ ] ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd match on AstHelpers.getListSingleton for the last argument to also cover List.singleton calls. See https://github.com/jfmengels/elm-review-simplify/blob/main/src/Simplify/AstHelpers.elm#L201-L221

Comment on lines +11997 to +12005
[ Fix.removeRange
{ start = checkInfo.parentRange.start
, end = singleRange.start
}
, Fix.removeRange
{ start = singleRange.end
, end = checkInfo.parentRange.end
}
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will e.g. fix

[ f <| string ] |> String.join sep
--> f <| string

which can lead to invalid syntax.
A better alternative is replaceBySubExpressionFix, see https://github.com/jfmengels/elm-review-simplify/blob/main/src/Simplify.elm#L14642-L14648

Adding a test for this would be nice, too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String.join / String.concat with a single element

2 participants