Fix multiple bugs in metaclass management of ShiftClassBuilder#16722
Merged
MarcusDenker merged 4 commits intopharo-project:Pharo13from May 31, 2024
Merged
Fix multiple bugs in metaclass management of ShiftClassBuilder#16722MarcusDenker merged 4 commits intopharo-project:Pharo13from
MarcusDenker merged 4 commits intopharo-project:Pharo13from
Conversation
If you have a class using traits, its metaclass will be TraitedMetaclass. Now, if you remove its traits, its class should be Metaclass. The problem is that if you use #fillFor: it will not be the case. The origin of the problem comes from the fact that #fillFor: will set the metaclass class to TraitedMetaclass and this will not be updated if you set the trait composition to be empty. I provided a fix that is not so good in my opinion, but I'll try to change the way the class builder deals with metaclass class later to simplify this system and remove the need of this fix. Finally I moved a test from shift class builder tests to traits tests since it uses a trait
…metaclass class selected
Member
Author
|
This could potentially fix a random bug that make a class trait composition addition appear in Iceberg from time to time in the diff |
MarcusDenker
approved these changes
May 31, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes multiples bugs I detected in the management of metaclasses of the ShiftClassBuilder.
The first bug was appearing when we had a class using a trait and we updated it using #fillFor: in the class builder block, then we removed the trait composition. This produced a class without trait but with a TraitedMetaclass class.
When using the #<< method to have the Fluid syntax, if the class had a trait in the past, it would always be produced with a TraitedMetaclass as a class even if the traits are removed.
I don't know why but using #<< was always preserving the old class trait composition which could lead to some problems in case you removed a trait.
My way to fix the problem is to update the management of the metaclass class in the ShiftClassBuilder. Before it was a variable that we had to set when we were managing our traits. Now this is an information that is resolved during the class building. It is delegated to the BuilderEnhancer. Thus, it is still possible to set our own metaclass class by adding a new buider enhancer!
Fixes #16472