Refactor baselang code of physunits language#1648
Merged
kbirken merged 6 commits intomaintenance/mps20241from Feb 24, 2026
Merged
Refactor baselang code of physunits language#1648kbirken merged 6 commits intomaintenance/mps20241from
kbirken merged 6 commits intomaintenance/mps20241from
Conversation
…physunits_language_1647
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 refactors and simplifies the implementation of the physunits language. It introduces a new
UnitMapclass, simplifies code where possible, makes it more readable, extract code in helper methods, reduces redundancy.The overall goal is to do a strict refactoring, without any logic change.
Important: The method
IConvertUnitHelper.replaceValExprWithBaseType()produces temporary Expression nodes which are inconsistent, as some descendants are not Expressions, but Types. It seems to work nevertheless, as these expressions are only used for computing types - but it could be a pitfall for future developers. In this refactoring PR, I didn't change this, but added a javadoc to raise awareness for the problem.According to the boyscouts rule, the PR fixes the previously flaky test
Time/testclockin modeltest.in.expr.os.mutable. This has nothing to do with physunits, but I was annoyed about the failing builds on CI due to this test.For the PR review, I keep the separate commits, as it might be easier to grok the changes commit by commit. Before merge, I can squash the branch.
This solves #1647.