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

[RB] replace senders should look in the hierarchy #17739

Open
Ducasse opened this issue Feb 1, 2025 · 1 comment
Open

[RB] replace senders should look in the hierarchy #17739

Ducasse opened this issue Feb 1, 2025 · 1 comment

Comments

@Ducasse
Copy link
Member

Ducasse commented Feb 1, 2025

It looks like the replace sender only look in the class and not in the hierarchy.

@Ducasse
Copy link
Member Author

Ducasse commented Feb 1, 2025

Its applicability is

applicabilityPreconditions

	^ {
		  (RBCondition withBlock: [
			   oldSelector numArgs < newSelector numArgs ifTrue: [
				   oldSelector numArgs + self newArgs size = newSelector numArgs
					   ifFalse: [
						   self refactoringError:
							   'You don''t have the necessary initializers to replace senders.' ] ].
			   true ]).
		  (RBCondition definesSelector: oldSelector in: class).
		  (RBCondition definesSelector: newSelector in: class) }
	"This is unclear that the targeting method should already be defined."

and

definesSelector: aSelector in: aClass
	^self new
		block: [aClass directlyDefinesMethod: aSelector]
		errorString: aClass printString , ' <1?:does not >define<1?s:> ' , aSelector printString

So replace Message Send should be replace self send.

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

No branches or pull requests

1 participant