apply-refact icon indicating copy to clipboard operation
apply-refact copied to clipboard

when -> unless refactor drops parens

Open Profpatsch opened this issue 5 years ago • 1 comments

-  when (not $ isStaffMail email) ($(logThrow) Unauthorized)
+  unless isStaffMail email ($(logThrow) Unauthorized)

This happens when the unless refactor is applied. Not sure if related to the TH splice.

Expected result:

unless (isStaffMail email) ($(logThrow) Unauthorized)

Profpatsch avatar Sep 24 '20 13:09 Profpatsch

@Profpatsch Sorry for not replying earlier - I somehow just saw this.

I wasn't able to reproduce this with hlint 3.2.1 and apply-refact 0.8.2.0. I tried to refactor a module that contains

x = when (not $ isStaffMail email) ($(logThrow) Unauthorized)

and it worked as expected. IIRC there were some refactoring-related bug fixes in recent HLint versions, so please use the latest version and let me know if you still have this issue.

zliu41 avatar Nov 15 '20 04:11 zliu41