Skip to content

Refactor baselang code of physunits language#1648

Merged
kbirken merged 6 commits intomaintenance/mps20241from
feature/refactor_physunits_language_1647
Feb 24, 2026
Merged

Refactor baselang code of physunits language#1648
kbirken merged 6 commits intomaintenance/mps20241from
feature/refactor_physunits_language_1647

Conversation

@kbirken
Copy link
Copy Markdown
Member

@kbirken kbirken commented Feb 21, 2026

This PR refactors and simplifies the implementation of the physunits language. It introduces a new UnitMap class, 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/testclock in model test.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.

Copy link
Copy Markdown
Member

@dbinkele dbinkele left a comment

Choose a reason for hiding this comment

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

LGTM

@kbirken kbirken merged commit 4daad99 into maintenance/mps20241 Feb 24, 2026
2 checks passed
@kbirken kbirken deleted the feature/refactor_physunits_language_1647 branch February 24, 2026 09:30
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