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

Subclass replacement operator #75

Merged
merged 24 commits into from
Feb 14, 2024

Conversation

DurieuxPol
Copy link
Collaborator

Added a new operator, MTSubclassReplacementOperator, which replaces a class referenced by a reference for each of its subclasses, thus creating a mutant for each one.
It's worth noting that only direct subclasses are considered, not all subclasses.

Copy link
Contributor

@guillep guillep left a comment

Choose a reason for hiding this comment

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

Some comments!

ifFalse: [
self
timesToApplyIn: aCompiledMethod
with: aParseTree ].
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh we are going to simplify this in our next pair programming session! ;)

src/MuTalk-Model/MTParametricMethodMutation.class.st Outdated Show resolved Hide resolved
shouldReplace := referencedClass isClass and: [
referencedClass subclasses notEmpty ].
shouldReplace ifTrue: [ classesToReplace add: referencedClass ].
shouldReplace ] ] ]
Copy link
Contributor

Choose a reason for hiding this comment

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

I want that we discuss how to fix this. I know you just followed how others were done, but I don't like blocks used like this!

src/MuTalk-Model/MTSubclassReplacementOperator.class.st Outdated Show resolved Hide resolved
@DurieuxPol
Copy link
Collaborator Author

It even seems like the CI is ok now

@guillep
Copy link
Contributor

guillep commented Feb 7, 2024

It even seems like the CI is ok now

Oh Nice!

Copy link
Contributor

@guillep guillep left a comment

Choose a reason for hiding this comment

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

Some more comments, be careful not duplicating code if not needed!

@@ -19,12 +19,14 @@ MTMethodMutationTest >> testAccessing [
operator := MTReplacePlusWithMinusMutantOperator new.
modifiedSource := operator
modifiedSourceFor: compiledMethod
number: 1.
number: 1
newExpression: operator newExpression.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could have a method

MTOperator >> modifiedSourceFor: aMethod number: aNumber
    self modifiedSourceFor: aMethod number: aNumber newExpression: self newExpression

to avoid duplication right?

src/MuTalk-Tests/MTMethodMutationTest.class.st Outdated Show resolved Hide resolved
@guillep guillep closed this Feb 14, 2024
@guillep guillep reopened this Feb 14, 2024
@guillep guillep closed this Feb 14, 2024
@guillep guillep reopened this Feb 14, 2024
Copy link
Contributor

@guillep guillep left a comment

Choose a reason for hiding this comment

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

Thanks @DurieuxPol !

Let's discuss about that empty method later!

]

{ #category : 'instance creation' }
MTSubclassReplacementOperator >> newNodeFrom: anOldNode [
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this method empty now?

@guillep guillep merged commit aee676f into pharo-contributions:master Feb 14, 2024
4 of 12 checks passed
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

Successfully merging this pull request may close these issues.

2 participants