Open alanz opened 8 years ago
Input in Test.hs
:
module Test (f) where
g :: Double
g = 9.81
-- adds g to x
f x = x + g
Command line: cabal exec ghc-hare rename Test.hs h 7 1
Output in Test.refactored.hs
:
module Test (f) where
g :: Double
g = 9.81
-- adds g to x
f x = x + g
-- adds g to x
h x = x + g
I expected that renaming a function will rewrite the export list and remove the old definition. Instead it duplicated the definition of f
(cursor position 7,1
).
Actually I tested on the master branch of my fork that contains no modifications yet.
Also when I want to rename g
to h
at cursor position 4,1
in the same input file, the definition of g
will be duplicated as h
, and the reference to g
in the body of f
also remains unchanged.
Maybe I am misusing something because executing addOneParam
instead of rename
gives exactly the same results.
Thanks, I will set up a test case.
On Fri, Feb 19, 2016 at 5:56 PM, Karácsony Máté notifications@github.com wrote:
Also when I want to rename g to h at cursor position 4,1 in the same input file, the definition of g will be duplicated as h, and the reference to g in the body of f also remains unchanged.
— Reply to this email directly or view it on GitHub https://github.com/RefactoringTools/HaRe/issues/24#issuecomment-186275370 .
The CLI driver was recently changed in master, it sounds like it is doing a dupDef, maybe that is the problem.
There is not currently a set of tests calling the exe to check the CLI invocation
On Fri, Feb 19, 2016 at 5:58 PM, Karácsony Máté notifications@github.com wrote:
Maybe I am misusing something because executing addOneParam instead of rename gives exactly the same results.
— Reply to this email directly or view it on GitHub https://github.com/RefactoringTools/HaRe/issues/24#issuecomment-186276068 .
Yes, see
https://github.com/alanz/HaRe/blob/master/src/MainHaRe.hs#L168
On Fri, Feb 19, 2016 at 6:07 PM, Alan & Kim Zimmerman alan.zimm@gmail.com wrote:
The CLI driver was recently changed in master, it sounds like it is doing a dupDef, maybe that is the problem.
There is not currently a set of tests calling the exe to check the CLI invocation
On Fri, Feb 19, 2016 at 5:58 PM, Karácsony Máté notifications@github.com wrote:
Maybe I am misusing something because executing addOneParam instead of rename gives exactly the same results.
— Reply to this email directly or view it on GitHub https://github.com/RefactoringTools/HaRe/issues/24#issuecomment-186276068 .
Yes, and also here:
https://github.com/alanz/HaRe/blob/master/src/MainHaRe.hs#L148
PR's cheerfully accepted here :)
Done, see #25. Now it works as expected :)