Skip to content

Conversation

@carolahp
Copy link
Contributor

No description provided.

@request-info
Copy link

request-info bot commented Oct 23, 2025

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.

@jecisc jecisc added the Status: Need more work The issue is nearly ready. Waiting some last bits. label Oct 23, 2025
@carolahp carolahp marked this pull request as draft October 23, 2025 13:50
Copy link
Member

@balsa-sarenac balsa-sarenac left a 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.

Comment on lines 18 to 20
RBNewAbstractCondition >> candidates [
"Complex conditions require this method to compute their own subjects"
^ subjects
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree

Copy link
Member

@balsa-sarenac balsa-sarenac left a 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: Балша Шаренац <[email protected]>
@carolahp
Copy link
Contributor Author

What is the status of this PR? Should I do a full review?

I am about to finish, I only have 13 tests not passing.
I merged the changes from PR#18890, to work on the latest version, in a fresh image. I will merge it all back to this branch as soon as I fix the tests

@Ducasse
Copy link
Member

Ducasse commented Nov 15, 2025

There is a failing test

testFailure
Found undeclared Variables: 
RBProtectVariableTransformation in: RBProtectVariableTransformationTest>>#testVariableDoesNotExist
ReleaseTest(TestAsserter)>>assert:description:resumable:
ReleaseTest(TestAsserter)>>assert:description:
[ "we compile a second method with the undeclared #undeclaredStubInstVar1 to trigger the code path of removing twice in #cleanOutUndeclared"
	self class compile: 'methodForTest ^undeclaredStubInstVar1'.
	Smalltalk cleanOutUndeclared.
	undeclaredVariables := Undeclared associations select: [ :each | each isUndeclaredVariable ].

	validExceptions := { #undeclaredStubInstVar1. #undeclaredStubInstVar2. #Gofer }. "The laste one is for Smalltalk CI and our external projects... But we should find a better solution at some point."

	"for now we filter by name, maybe filtering by variable would be better"
	remaining := undeclaredVariables reject: [ :each | validExceptions includes: each name ].

	"we look for one of the using methods of the undeclared var and report that,
	this should be enough to fix it quickly"
	description := String streamContents: [ :stream |
		               stream nextPutAll: 'Found undeclared Variables: '.
		               remaining do: [ :variable |
			               | method |
			               method := variable usingMethods anyOne.
			               stream cr
				               nextPutAll: variable name;
				               nextPutAll: ' in: ';
				               print: method methodClass;
				               nextPutAll: '>>';
				               print: method selector ] ].

	self assert: remaining isEmpty description: description ] in ReleaseTest>>testUndeclared
FullBlockClosure(BlockClosure)>>ensure:
ReleaseTest>>testUndeclared
ReleaseTest(TestCase)>>performTest
		

@jecisc
Copy link
Member

jecisc commented Nov 15, 2025

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 })).
Copy link
Member

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.

Suggested change
((ReClassesExistCondition new classes: { (class name -> class) }) & (ReClassesAreNotMetaClassCondition new classes: { class })).
((ReClassesExistCondition new classes: { (class name -> class) }).
(ReClassesAreNotMetaClassCondition new classes: { class })).

Comment on lines +52 to +62
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 ]
Copy link
Member

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?

Comment on lines +32 to +37
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.' ]
]
Copy link
Member

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'.
Copy link
Member

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

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

more-information-needed Status: Need more work The issue is nearly ready. Waiting some last bits.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants