• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eclipse-aascw / aas-core-codegen / 36059472310

24 Sep 2026 09:07PM UTC coverage: 87.409% (+0.1%) from 87.314%
36059472310

push

github

web-flow
Transpile `isinstance` (#763)

We introduce ``isinstance`` in the transpilable code so that
the verification functions, which are implementation-specific in
aas-core-meta V3.2, can be transpiled.

The parse stage understands ``isinstance(x, C)`` and
``isinstance(x, (A, B))``. The type inference checks that the value is
a non-optional class or named union, and that each class is a strict
descendant of the value's class, or a root of its named union or
a descendant of a root, respectively.

A single-class ``isinstance`` narrows the value in the conjunctions,
implications, disjunctions of the form ``not isinstance(...) or ...``
and in the conditions of ``all`` and ``any``. The type inference
exposes the narrowed values as ``downcast_map`` together with their
type before the narrowing, so that the targets know where and how
to down-cast. To that end, ``infer_for_invariant`` now returns
an ``InferenceOfInvariant``.

All the targets transpile ``isinstance``. A value of a named union is
checked and down-cast through its underlying instance: ``Underlying``
in C#, ``getUnderlying()`` in Java, ``Underlying()`` in Go, and the new
public ``types::UnderlyingOf{Union}`` in C++. In TypeScript and Python,
a named union is a plain type alias, so no unwrapping is needed.

We also fix string comparisons in Java, which compared the references
instead of the values, the missing types package in the closures of
Go verification functions, and the lint error on unused dispatchers
of named unions in TypeScript.

465 of 519 new or added lines in 22 files covered. (89.6%)

37210 of 42570 relevant lines covered (87.41%)

2.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.55
/aas_core_codegen/java/optional.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc