Skip to content

fix: restore scope and export expression code generation - #1436

Merged
joaodinissf merged 3 commits into
dsldevkit:masterfrom
joaodinissf:followup/scope-expression-codegen-test
Aug 26, 2026
Merged

fix: restore scope and export expression code generation#1436
joaodinissf merged 3 commits into
dsldevkit:masterfrom
joaodinissf:followup/scope-expression-codegen-test

Conversation

@joaodinissf

@joaodinissf joaodinissf commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Restores and tests two expression-generation behaviours in the scope and export DSL pipelines.

Nested arithmetic

isNumber() previously relied on resolveType(). That returns null for an arithmetic OperationCall, so an outer operation could misclassify a nested arithmetic expression and render it as a method call:

*(4 + 2, 3)

The compilers now recognize nested arithmetic operations recursively, producing valid Java such as:

(4 + 2) * 3

This was a real latent generation bug: existing repository models did not exercise nested arithmetic, so the malformed output had escaped CI.

Equality translation

The Xbase translator mappings for == and != implement value equality, while the scope and export string compilers intentionally emit Java identity equality.

The translators now leave these operators unsupported so generation falls back to the existing string compilers. Current production generation already uses that fallback for these expressions, so this is a defensive translator-contract correction rather than evidence of a live equality regression.

Both changes are applied symmetrically to scope and export.

Tests

Adds a shared expression-generation test harness with concrete scope and export test classes, registered in the existing aggregate test suite.

The tests cover:

  • nested and recursively nested arithmetic;
  • simple arithmetic and string-concatenation controls;
  • the requirement that equality and inequality remain untranslated.

Before the fix, nested arithmetic failed in both compiler implementations and the equality translators violated the fallback contract. All six inherited tests pass after the fix.

Versioning

Bumps the scope and export bundles from 17.3.2 to 17.3.3 because both contain production-code changes.

Validation

  • Scope and export regression tests pass.
  • Checkstyle, PMD, CPD, and SpotBugs pass.
  • The full aggregate suite executes the new tests successfully.

@joaodinissf
joaodinissf force-pushed the followup/scope-expression-codegen-test branch 2 times, most recently from e6d93db to bc585e0 Compare August 25, 2026 17:15
rubenporras
rubenporras previously approved these changes Aug 26, 2026
Recognize nested arithmetic calls recursively as numeric expressions. Without this, an outer arithmetic call can fall through to method-call rendering and produce invalid Java such as *(4 + 2, 3).

Leave == and != untranslated because Xbase equality is value-based while the legacy Java generator emits identity equality. Current production generation already uses the string compiler for these expressions, so this is a defensive translator-contract correction rather than a live equality regression.

Apply both changes symmetrically to the duplicated Scope and Export expression pipelines.
@joaodinissf
joaodinissf force-pushed the followup/scope-expression-codegen-test branch from bc585e0 to d5b4c0d Compare August 26, 2026 09:59
rubenporras
rubenporras previously approved these changes Aug 26, 2026
@joaodinissf joaodinissf changed the title fix: faithful ==/nested-arithmetic codegen in scope/export expression translation (follow-up to #1405) fix: restore scope and export expression code generation Aug 26, 2026
Add focused generator tests for recursive arithmetic, arithmetic/string-concatenation controls, and the unsupported equality translator contract in both duplicated DSL pipelines. Register them in the existing aggregate test suite.
Both bundles change production code relative to their 17.3.2 baselines.
@joaodinissf
joaodinissf force-pushed the followup/scope-expression-codegen-test branch from 1769686 to 7154a31 Compare August 26, 2026 11:32
@joaodinissf
joaodinissf marked this pull request as ready for review August 26, 2026 11:59
@joaodinissf
joaodinissf merged commit caa8c82 into dsldevkit:master Aug 26, 2026
4 checks passed
@joaodinissf
joaodinissf deleted the followup/scope-expression-codegen-test branch August 26, 2026 13:25
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