mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
0279a5ab7c
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>