Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addOneParam issue #24

Open
alanz opened this issue Feb 19, 2016 · 10 comments
Open

addOneParam issue #24

alanz opened this issue Feb 19, 2016 · 10 comments

Comments

@alanz
Copy link
Collaborator

alanz commented Feb 19, 2016

I wanted to try out hare from the command line and I have some "strange" results [22:46:53]
actually I tried "rename" and "addOneParam" on a very simple function, but all that happened is the function definition get duplicated [22:47:42]

@kmate, please provide details

@kmate
Copy link
Contributor

kmate commented Feb 19, 2016

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).

@kmate
Copy link
Contributor

kmate commented Feb 19, 2016

Actually I tested on the master branch of my fork that contains no modifications yet.

@kmate
Copy link
Contributor

kmate commented Feb 19, 2016

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.

@kmate
Copy link
Contributor

kmate commented Feb 19, 2016

Maybe I am misusing something because executing addOneParam instead of rename gives exactly the same results.

@alanz
Copy link
Collaborator Author

alanz commented Feb 19, 2016

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
#24 (comment)
.

@alanz
Copy link
Collaborator Author

alanz commented Feb 19, 2016

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
#24 (comment)
.

@alanz
Copy link
Collaborator Author

alanz commented Feb 19, 2016

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
#24 (comment)
.

@kmate
Copy link
Contributor

kmate commented Feb 19, 2016

@alanz
Copy link
Collaborator Author

alanz commented Feb 19, 2016

PR's cheerfully accepted here :)

@kmate
Copy link
Contributor

kmate commented Feb 19, 2016

Done, see #25. Now it works as expected :)

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

No branches or pull requests

2 participants