unblock voxel schema loading, add test for express

This commit is contained in:
Ghesselink
2026-05-04 15:33:34 +00:00
committed by Thomas Krijnen
parent 53c2ddbb47
commit ab73550059
2 changed files with 95 additions and 2 deletions
@@ -420,7 +420,13 @@ class SchemaClass(codegen.Base):
if isinstance(type, nodes.AggregationType):
aggr_type = type.aggregate_type
make_bound = lambda b: -1 if b == "?" else int(b)
def make_bound(b):
# `?` and non-literal bounds (attribute references, arithmetic expressions) collapse to -1.
#
try:
return int(b)
except (TypeError, ValueError):
return -1
bound1, bound2 = map(make_bound, (type.bounds.lower, type.bounds.upper))
decl_type = get_declared_type(type.type, emitted_names)
return x.aggregation_type(aggr_type, bound1, bound2, decl_type)
@@ -547,7 +553,14 @@ class SchemaClass(codegen.Base):
inv_attrs = []
for attr in type.inverse:
if attr.bounds:
make_bound = lambda b: -1 if b == "?" else int(b)
def make_bound(b):
# `?` and non-literal bounds (attribute references, arithmetic
# expressions) collapse to -1 (unbounded) — the C++ runtime has
# no third state for "dynamic cardinality".
try:
return int(b)
except (TypeError, ValueError):
return -1
bound1, bound2 = map(make_bound, (attr.bounds.lower, attr.bounds.upper))
else:
bound1, bound2 = -1, -1