Script: a struct can't use a vector or array type declared earlier in the same script
Describe the bug
In a script, struct declarations are evaluated while the script is type-checked, but vector and array types declared as entities (Points { vector: {type: f32} }) are only created when the script runs. So a struct can't name a vector or array type declared above it in the same script.
To Reproduce Run this script:
using flecs.meta
Points { vector: {type: f32} }
struct Body(trail: Points)It fails with:
error: 3: unresolved identifier 'Points'
struct Body(trail: Points)
^The same declarations work when split into two scripts run in order. The member syntax also works in a single script:
using flecs.meta
Points { vector: {type: f32} }
Body {
trail { member: {type: Points} }
}Enums and bitmasks don't have the problem, since they're evaluated during type checking too.
Expected behavior A struct declaration can use types declared earlier in the same script, or vectors and arrays have a declaration form that's evaluated alongside structs, enums and bitmasks.
Additional context
Flecs master at 9e874bc (2026-09-12), macOS, clang.
Source: SanderMertens/flecs