-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
making a concept abstract or changing its inheritance should be considered a breaking change #937
Comments
Hi @DS-AdamMilazzo , I'd love to tackle this issue. Any ideas where I should start looking? |
See the code I linked to above:
It reports incompatibilities in classes. For example, it's currently checking some aspects of the type (computed by context.report({
key: 'class-declaration-type-changed',
message: `The ${aType} "${a.getName()}" changed type from ${aType} to ${bType}`,
element: a
}); A new check should be added there to flag the abstractness of the class changing. Going from abstract -> concrete is a minor (non-breaking) change, and going from concrete -> abstract is a major (breaking) change. Search the code for "class-declaration-type-changed" to see where those are defined, and add the new entry there. |
Hi @DS-AdamMilazzo , const isAbstract =(declaration) => declaration.isAbstract( ); Abstract -> Concrete : Minor change. |
Hi @DS-AdamMilazzo , The pull request is ready for review. |
You should link to the PR. I guess it is #974 |
Bug Report 🐛
Expected Behavior
When comparing two models where the new model changes a concept from concrete to abstract, the change should be detected as a major (breaking) change. When changing the other way, from abstract to concrete, the change should be detected as a minor or patch (non-breaking) change.
When comparing two models where the new model changes a concept's inheritance, the change should be detected as a major (breaking) change. This could potentially be relaxed to a minor change if the new base type is derived (directly or indirectly) from the old base type and the newly intervening base types only add fields that would be allowed to be added directly to the concept at issue (i.e. optional fields whose names don't collide with existing fields).
Current Behavior
Currently, changing a concept between abstract and concrete is not detected as a model change, and neither is changing a concept's inheritance.
Possible Solution
Detect a change to a concept's abstractness in the model comparer and return one of two new result codes. Detect a change in base class and return a new result code (or two new result codes if you want to get fancy).
Steps to Reproduce
First, create two model files. A.cto:
and B.cto:
Then, run
concerto compare --old A.cto --new B.cto
No differences are reported.
Context (Environment)
It just seems like a bug that needs fixing.
Desktop
Detailed Description
Possible Implementation
In classDeclarationTypeChanged, check if the two concepts are equally abstract and if not return new comparison result
type-made-concrete
(minor or patch) ortype-made-abstract
(major).Also check if the base type has changed and if so return a new comparison result
supertype-changed
(major) (orconcept-extends-changed
to parallel the existingscalar-extends-changed
result). If you want to get fancy, you could allow some base type changes that are not breaking, as described above in the "Expected Behavior" section.The text was updated successfully, but these errors were encountered: