-
-
Notifications
You must be signed in to change notification settings - Fork 405
Fix for Negated condition violators (retry) #18738
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
base: Pharo14
Are you sure you want to change the base?
Fix for Negated condition violators (retry) #18738
Conversation
|
This issue has either a default title or empty body. We would appreciate it if you could provide more information. Note: I am not a very intelligent bot, I can only react to new comments. Please add a comment for me if you update the body or title. |
balsa-sarenac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just general comments not related to the PR, let me know when it's ready for full review.
| RBNewAbstractCondition >> candidates [ | ||
| "Complex conditions require this method to compute their own subjects" | ||
| ^ subjects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename iv to candidates too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, should this be removed since accessor is used everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I am removing it since we are using the accessor everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is general comment on all preconditions, we can discuss this on Thursday: I think we should have all Conditions classes be positive. I mean:
ReMethodsDontReferToLocalSharedVarsCondition -> ReMethodsReferToLocalSharedVarsCondition
This is easier to use, and negation makes more sense. Double negation is always a bit confusing and harder to reason about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I agree!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also agree
balsa-sarenac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the status of this PR? Should I do a full review?
Co-authored-by: Балша Шаренац <34557616+balsa-sarenac@users.noreply.github.com>
I am about to finish, I only have 13 tests not passing. |
…s-in-negated-conditions2
…olahp/pharo into fix/violators-in-negated-conditions2
|
There is a failing test |
|
We should merge P14 in this branch because I fixed those tests 2 days ago I think |
| self doesClassToBeRenamedExist and: [ self isNotMetaclass ] ]). | ||
| self isValidClassName. | ||
| self isNotGlobal } | ||
| ((ReClassesExistCondition new classes: { (class name -> class) }) & (ReClassesAreNotMetaClassCondition new classes: { class })). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't have to be joined with &, the have almost the same meaning if you put them as list items.
| ((ReClassesExistCondition new classes: { (class name -> class) }) & (ReClassesAreNotMetaClassCondition new classes: { class })). | |
| ((ReClassesExistCondition new classes: { (class name -> class) }). | |
| (ReClassesAreNotMetaClassCondition new classes: { class })). |
| ReReifiedCondition >> violationMessageOn: aStream violators: theViolators [ | ||
| | isNegated | | ||
| theViolators ifEmpty:[^self]. | ||
| isNegated := self violators ~= theViolators. | ||
|
|
||
| theViolators do: [ :violator | | ||
| aStream | ||
| nextPutAll: violator name; | ||
| nextPutAll: ('<1? is not:is>' expandMacrosWith: isNegated); | ||
| nextPutAll: ' empty.'; | ||
| space ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in ReifiedCondition, could it be that it ended up here by mistake? Since this is mentioning something empty?
| ReNotInCascadedMessageCondition >> violationMessageOn: aStream violators: theViolators [ | ||
|
|
||
| theViolators = self violators | ||
| ifTrue: [ aStream nextPutAll: 'Cannot extract code in a cascaded message.' ] | ||
| ifFalse: [ aStream nextPutAll: 'Can extract code in a non cascaded message.' ] | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something to think about.
@Ducasse this condition is generic (is this message cascaded), and we use it in extract method, and this error message says you cannot extract method from cascade.
I think this should be general message here, and then Extract Method needs to make it specific for its use case?
| { #category : 'displaying' } | ||
| ReNameIsGlobalCondition >> violationMessageOn: aStream [ | ||
|
|
||
| self deprecated: 'Use violationMessageOn:violators: instead'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this left here by mistake? or is this always deprecated? I forgot what we decided in the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ducasse these tests fail since ProtectVariableTransformation was removed. I'm guessing we should remove these tests as well? But also to make sure these tests exist for RBProtectInstanceVariableRefactoring
No description provided.