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

Class rename also updates method sends (3.0.76) #513

Closed
LisaAlmarode opened this issue Aug 28, 2019 · 10 comments
Closed

Class rename also updates method sends (3.0.76) #513

LisaAlmarode opened this issue Aug 28, 2019 · 10 comments
Assignees

Comments

@LisaAlmarode
Copy link
Member

LisaAlmarode commented Aug 28, 2019

If you have a method send within a method that is the same as the class name, the method name gets updated.

The class is named RenameTest.
instance methods:

RenameTest
^self class
test
^self RenameTest

When I renamed RenameTest to NewName,
the RenameTest method was unchanged.
the test method was updated:

^self NewName

which will fail since there's no method NewName.
It would be more serious if it was likely that this occurred under normal conditions - I just stuck a 'self' in front of the class name so I would be able to test the rename.

This is a good time to also request that I not be informed if no methods were updated. That extra dialog I don't need.

@ericwinger
Copy link
Member

Note - updated issue report for easier to read formatting

ericwinger pushed a commit that referenced this issue Aug 29, 2019
Removed dialog & and make sure methods are still shown after rename
@ericwinger
Copy link
Member

Removed the dialog in 3.0.77 but the primary complaint is a Rowan issue as the recompiled method behavior is handled there. Closing.

@LisaAlmarode - Can you create a Rowan issue for the primary complaint?

@LisaAlmarode
Copy link
Member Author

I'm afraid we can't just close issues that show up in Oscar if we are waiting on a fix in Rowan. They are still bugs.

@LisaAlmarode
Copy link
Member Author

Opened rowan bug for Eric:
GemTalk/Rowan#509

@dalehenrich
Copy link
Member

I refer you this comment ... the mistaken edit is occurring right here in RowanClassService code.

@ericwinger
Copy link
Member

@dalehenrich is correct. Services is making the changes to methods and is responsible for updating renamed classes in method source properly. (Oversight / Faulty memory on my part)

I believe a fix is to look for references to the old class rather than the old class name in RowanClassService>>renameClass:To: using ClassOrganizer>>referencesToObject:. That will eliminate the immediate problem.

However, referencesToObject: does not return the source offset of the referenced class. If I had the offset, I could surgically replace class names in method sources and eliminate the substring search & replace referenced in this comment. @dalehenrich Do you know if there is a method that will return references to a class with the reference's source offset? I couldn't find one in ClassOrganizer

If there isn't a way to find the references to the class object with source offsets, maybe we can just live with a substring search / replace. After all, we do display the changed methods so the user can review and fix any mistakes.

Thoughts @LisaAlmarode?

@dalehenrich
Copy link
Member

@dalehenrich Do you know if there is a method that will return references to a class with the reference's source offset? I couldn't find one in ClassOrganizer

@ericwinger I don't know of anyplace other than ClassOrganizer for doing references ... in the past I have written custom methods for tODE, but I don't think I've done anything quite like what you are looking for ... should be possible to write something that does that though

@ericwinger
Copy link
Member

I've improved the reference search to only search for references to the class, not the class name. GemTalk/Rowan@b207488

@LisaAlmarode Dale's suggestion to write up an object reference search with offsets is a good one. However, after reviewing the GsNMethod code, I think that's a bit outside the scope of our November release. If I'm correct, can you remove the November 19 label?

@LisaAlmarode
Copy link
Member Author

The basic issue is fixed, so I am fine to remove the November 19 label.

I'm not entirely sure I follow the details of the discussion. Are there some behaviors that are incorrect, or do you want to improve the underlying code?

(Boy, do I dislike autocomplete! It slowed things down like crazy (perhaps since I'm remote), and I accidentally entered wrong code. I suggest the default be off).

@LisaAlmarode
Copy link
Member Author

As of v3.2.12, my method doesn't get renamed; this issue is fixed.

Opened issue #974 for the converse, methods on that class that refer to that class fail to recompile, which I think is the point of the later discussion under this issue.

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

3 participants