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

Remove class refactoring should not warn user if the class reference itself #4550

Closed
jecisc opened this issue Sep 10, 2019 · 5 comments · Fixed by #4553

Comments

@jecisc
Copy link
Member

commented Sep 10, 2019

Currently, if a class reference itself and you try to remove it, you get a warning saying the class is referenced.

In case the class reference itself, it should not warn the user.

@MarcusDenker

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

Hmm.. I can not reproduce that.

The check seems to remove the name as intended and I get not warning:

preconditionHasNoReferences: aClass

| env |
env := self environmentWithReferencesTo: aClass.
^ (RBCondition withBlock: [ (env classNames copyWithoutAll: classNames) isEmpty ])
		errorMacro: aClass , ' is referenced.<n>Browse references?';
		errorBlock: [ self openBrowserOn: (env) ];
		yourself
@MarcusDenker

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

RBRemoveClassRefactoring

@jecisc

This comment has been minimized.

Copy link
Member Author

commented Sep 11, 2019

2019-09-11 13 16 36

@jecisc

This comment has been minimized.

Copy link
Member Author

commented Sep 11, 2019

So it happens with class side because it check names and in the class side there is " class" at the end of the name.

@MarcusDenker

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

fix: in ClyBrowserMorph>>#confirmUnusedClasses:

noUsers needs to exclude both class and instance side:

noUsers := self confirmEmptySystemQuery: refQuery excluding: (classes flatCollect: [ :each | { each . each classSide } ]).
MarcusDenker added a commit to MarcusDenker/pharo that referenced this issue Sep 11, 2019
fix pharo-project#4550
fix is  to exclude both class and instance side
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.