Skip to content

sheharyarn/memento

Back fix: Elixir 1.19 record/0 built-in type collision (#44)

Commit details

fix: Elixir 1.19 record/0 built-in type collision (#44)

Description

* fix: rename Memento.Table.record type to record_t (Elixir 1.19 built-in collision) Elixir 1.19.5 added a built-in type `record/0`. Memento's `@type record :: struct()` in `Memento.Table` now triggers a TypespecError ("type record/0 is a built-in type and it cannot be redefined") on compile, breaking projects that depend on memento under Elixir >= 1.19. This renames the typedef + all internal references (5 sites total): - lib/memento/table/table.ex:85 -- @type record :: struct() - lib/memento/query/data.ex:54 -- @spec load(tuple) :: Memento.Table.record - lib/memento/query/data.ex:78 -- @spec dump(Memento.Table.record) :: tuple - lib/memento/query/query.ex:121 -- typedoc reference t:Memento.Table.record/0 - lib/memento/query/query.ex:625 -- typedoc reference t:Memento.Table.record/0 All occurrences renamed to `record_t` (conventional `_t` suffix for type aliases). Behaviour unchanged; only the type name changes. * fix: rename aliased Table.record references in query.ex Follow-up to the previous commit. `query.ex` aliases `Memento.Table` and uses the short form `Table.record` throughout — the previous patch only renamed the fully-qualified `Memento.Table.record` references, missing 9 `@spec` sites that use the aliased short form. These would still fail to resolve once the underlying type is renamed. Sites renamed: - lib/memento/query/query.ex:204 -- @spec read - lib/memento/query/query.ex:248 -- @spec write (x2) - lib/memento/query/query.ex:277 -- @spec all - lib/memento/query/query.ex:332 -- @spec match - lib/memento/query/query.ex:421 -- @spec select - lib/memento/query/query.ex:567 -- @spec select_raw - lib/memento/query/query.ex:648 -- @spec delete_record (plus one occurrence in a moduledoc example) The rename is now complete; `grep -rn 'Table\.record\\b\\|@type record\\b' lib/` returns nothing.

Metadata

Author
Matthew Sinclair hello@matthewsinclair.com
Committed
Commit

Contributors

  • Matthew Sinclair hello@matthewsinclair.com Author