Skip to content

fix: detect typedef-aliased arrays and their const qualifier - #97

Merged
xxthunder merged 1 commit into
developfrom
feat/fix_const_array_mock
Apr 28, 2026
Merged

xxthunder merged 1 commit into
developfrom
feat/fix_const_array_mock

Conversation

@xxthunder

@xxthunder xxthunder commented Apr 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Recognize typedefs that resolve to array types as arrays, by also checking the canonical type in RenderableType.is_array.
  • Correctly detect const on a typedef-to-array variable (const Foo bar where typedef T Foo[N]), where the qualifier applies to the typedef rather than the element type.

Previously, extern Foo bar; (with typedef uint8 Foo[4];) was mocked as a scalar and produced an invalid initializer. const Foo bar; was additionally not flagged as constant.

Test plan

  • New test_typedef_array — typedef-to-array is detected; initializer is {0}.
  • New test_const_typedef_array — const on the typedef is recognized; initializer is {0}.
  • Existing const/array tests still pass (87 passed).

@xxthunder
xxthunder force-pushed the feat/fix_const_array_mock branch from 9b93439 to 015f4ac Compare April 28, 2026 14:30
Make is_array check the canonical type so typedef aliases to array types
(e.g. typedef uint8 Foo[N]) are correctly recognized. Update is_constant
to handle const qualification on typedef arrays. Remove the redundant
canonical-type fallback in initializer().

Co-authored-by: Jan Vollmuth <Jan.Vollmuth@marquardt.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@xxthunder
xxthunder force-pushed the feat/fix_const_array_mock branch from 015f4ac to bc67cb1 Compare April 28, 2026 14:37
@xxthunder xxthunder mentioned this pull request Apr 28, 2026
@xxthunder xxthunder changed the title fix: const array mock fix: detect typedef-aliased arrays and their const qualifier Apr 28, 2026
@xxthunder
xxthunder merged commit e3e8e74 into develop Apr 28, 2026
6 checks passed
@xxthunder
xxthunder deleted the feat/fix_const_array_mock branch April 28, 2026 20:48

This branch was previously deployed

1 inactive deployment
release — bc67cb11 Deployed Apr 28, 2026 by xxthunder via release #106
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