Files
Petru Conduraru 0279a5ab7c express: include referencing SELECT types in typeof() (#3187)
Per ISO 10303-11 12.4.3, TYPEOF() must return every type a value conforms
to, including any SELECT data type that references it (transitively) as a
member. The previous implementation only walked entity supertypes and
defined-type chains, so it never reported SELECT types. This silently
broke every WHERE rule that tests SELECT membership through typeof: for
example IfcFillAreaStyle.MaxOneColour and ConsistentHatchStyleDef test
`'ifc4.ifccolour' in typeof(style)`, so an IfcFillAreaStyle with two
IfcColourRgb entries was never rejected.

typeof() now builds a per-schema (cached) reverse map from a type name to
the SELECT types that reference it as a direct member, then closes the
base type set over that map so selects-of-selects are also included. The
canonical implementation lives in the rule_compiler.py preamble and is
copied verbatim into every generated rules/*.py, so the source of truth
and the generated files are updated in lockstep.

Verified: typeof(IfcColourRgb) now yields ifccolour, ifccolourorfactor,
and ifcfillstyleselect; an IfcFillAreaStyle with two colours now fails
MaxOneColour. All 138 express rule fixtures still pass (75 pass-cases at 0
errors, 63 fail-cases still flagged), no regressions.

Generated with the assistance of an AI coding tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 08:06:49 +03:00
..