pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.22k stars 357 forks source link

Potentially useless message in LRUCache #17141

Open Salas3108 opened 2 months ago

Salas3108 commented 2 months ago

We run a mutation testing on LRUCache and we got this : Bug Potentiel Pharro

welcome[bot] commented 2 months ago

Thanks for opening your first issue! Please check the CONTRIBUTING documents for some tips about which information should be provided. You can find information of how to do a Pull Request here: https://github.com/pharo-project/pharo/wiki/Contribute-a-fix-to-Pharo

GitHub
Contribute a fix to Pharo
Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk. - pharo-project/pharo
Salas3108 commented 2 months ago
weight remove: link value value. 

is replaced by

weight remove: link yourself value.
svenvc commented 2 months ago

I am sorry, but this change does not seem correct.

Link in this code is an instance of DoubleLink that holds a value as well as backwards and forwards pointers.

The values in this particular double link list are Associations.

So link value value is getting the value of the association that is the value of a double linked list node.

Furthermore, sending yourself is a chain is a no-op, so could just as well remove it. At the same time, value and yourself are not equivalent.

Unless you think you found a bug, which would be helpful, I am pretty sure this is wrong.

jecisc commented 2 months ago

With the mutation testing, I think the idea was to report that we have either a missing test or a useless message.

I agree with you that this is probably due to a missing test (or we have dead code)

Ducasse commented 2 months ago

Yes we should then add a test.