Skip to content

Transpile string concatenation - #861

Merged
mristin merged 1 commit into
mainfrom
mristin/Transpile-string-concatenation
Oct 21, 2026
Merged

mristin merged 1 commit into
mainfrom
mristin/Transpile-string-concatenation

Conversation

@mristin

@mristin mristin commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

We transpile the addition of two strings, left + right, to the native concatenation in all the targets. The type inference refuses to mix a string with another type, as the targets convert the other operand to a string differently, or not at all.

C++ can not add two string literals, as they are pointers, so we convert the left one:

std::wstring extension = std::wstring(L".") + L"txt";

Along the way, we drop the redundant parentheses around a compound argument of OurCommon.lenStr in TypeScript.

We transpile the addition of two strings, ``left + right``, to
the native concatenation in all the targets. The type inference refuses
to mix a string with another type, as the targets convert the other
operand to a string differently, or not at all.

C++ can not add two string literals, as they are pointers, so we
convert the left one:

    std::wstring extension = std::wstring(L".") + L"txt";

Along the way, we drop the redundant parentheses around a compound
argument of ``OurCommon.lenStr`` in TypeScript.
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39674735794

Coverage increased (+0.001%) to 90.201%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (23 of 25 lines covered, 92.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
aas_core_codegen/cpp/transpilation.py 8 6 75.0%
Total (3 files) 25 23 92.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 51365
Covered Lines: 46332
Line Coverage: 90.2%
Coverage Strength: 2.71 hits per line

💛 - Coveralls

@mristin
mristin merged commit 7053312 into main Oct 21, 2026
5 checks passed
@mristin
mristin deleted the mristin/Transpile-string-concatenation branch October 21, 2026 21:14
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