Skip to content

Support in on lists and strings - #850

Merged
mristin merged 1 commit into
mainfrom
mristin/support-in-on-lists
Oct 15, 2026
Merged

mristin merged 1 commit into
mainfrom
mristin/support-in-on-lists

Conversation

@mristin

@mristin mristin commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

We support the membership in a list, e.g., number in seen, and in a string, e.g., "." in text, in all the targets. Go uses a new ourcommon.SliceContains, which compares as any, since the interfaces satisfy comparable only from Go 1.20 on, and strings.Contains. C++ checks for a sub-string with text.find(sub) != std::wstring::npos.

We look up the lists of integers with Long's in Java, e.g., getSomeInts().contains(0L), as the boxed Integer's are never equal to any Long.

We refuse the byte arrays as members of in, since Python compares them byte by byte, C# and Java by reference, and Go can not compare them at all. We refuse the JSON-able values as members in a list for the same reason.

We support the membership ``in`` a list, *e.g.*, ``number in seen``,
and in a string, *e.g.*, ``"." in text``, in all the targets. Go uses
a new ``ourcommon.SliceContains``, which compares as ``any``, since the
interfaces satisfy ``comparable`` only from Go 1.20 on, and
``strings.Contains``. C++ checks for a sub-string with
``text.find(sub) != std::wstring::npos``.

We look up the lists of integers with ``Long``'s in Java, *e.g.*,
``getSomeInts().contains(0L)``, as the boxed ``Integer``'s are never
equal to any ``Long``.

We refuse the byte arrays as members of ``in``, since Python compares
them byte by byte, C# and Java by reference, and Go can not compare
them at all. We refuse the JSON-able values as members in a list
for the same reason.
@mristin
mristin merged commit c5df122 into main Oct 15, 2026
4 checks passed
@mristin
mristin deleted the mristin/support-in-on-lists branch October 15, 2026 20:30
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 38800852661

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.02%) to 90.147%

Details

  • Coverage increased (+0.02%) 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 9 7 77.78%
Total (3 files) 25 23 92.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 50636
Covered Lines: 45647
Line Coverage: 90.15%
Coverage Strength: 2.7 hits per line

💛 - Coveralls

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