Skip to content

feat(ladfile): enum variants extend their enum in Lua, docgen testlib declares test types - #673

Open
makspll wants to merge 5 commits into
agent/lad-generic-asset-functionsfrom
agent/lad-lua-enum-variants-docgen-testlib
Open

makspll wants to merge 5 commits into
agent/lad-generic-asset-functionsfrom
agent/lad-lua-enum-variants-docgen-testlib

Conversation

@makspll

@makspll makspll commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Part of #512. Addresses #655 and part of #658.

  • Lua declarations: enum variant classes are not subtypes of their enum #655: enum variant classes now extend their enum (---@class time.TimerMode.Once : time.TimerMode, bms.EnumVariantRef, generic enums included), so Timer.new(TimerMode.Repeating) type-checks. Variants inherit the enum's fields and methods (the trade-off listed in the issue).
  • docgen testlib: declare test data types and test harness globals #658:
    • docgen runs headless (WinitPlugin disabled, WgpuSettings { backends: None }).
    • -- testlib registers the test types (test_utils::test_data::register_test_types: components, resources, bundles, TestAsset).
    • -- testlib writes assets/definitions/test_harness.lua declaring the assert_throws global.
    • _make_invalid_entity, _make_placeholder_entity, _entity_from_index and _get_entity_with_test_component return V<Entity>.

Not in this PR: #659 (CI check).

Tests: ladfile_builder/ladfile/lua_language_server_lad_backend/mdbook_lad_preprocessor (fixtures blessed), script_tests -- entity, cargo run --example docgen -- testlib headless.

…n testlib declares the test types

Variant classes extend the enum class, so a variant can be passed where the
enum is expected (e.g. Timer.new(TimerMode.Repeating)).

docgen runs headless, registers the test types, declares the assert_throws
global of the test harness, and the entity helpers return V<Entity>.
@makspll
makspll added this pull request to stack #674 October 27, 2026 10:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant