Skip to content

[DSLX] Fix imported types whose dimensions index an array constant. - #5546

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1023922365
Draft

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1023922365

Conversation

@copybara-service

Copy link
Copy Markdown

[DSLX] Fix imported types whose dimensions index an array constant.

When a type annotation from another module refers to a constant in that
module, the type checker replaces the reference with a number literal holding
the constant's value. Tuple-valued constants were skipped but arrays were not,
so a member like uN[WIDTHS[0]] of an imported struct failed in the importing
module with "Non-bits type used to define a numeric literal" (and no source
location, because the literal is fabricated). Leave array-valued constants as
references, like tuples.

Adds the mod_importer_array_const_dims DSLX language test, which imports plain
and parametric structs whose member widths index an array constant.

When a type annotation from another module refers to a constant in that
module, the type checker replaces the reference with a number literal holding
the constant's value. Tuple-valued constants were skipped but arrays were not,
so a member like `uN[WIDTHS[0]]` of an imported struct failed in the importing
module with "Non-bits type used to define a numeric literal" (and no source
location, because the literal is fabricated). Leave array-valued constants as
references, like tuples.

Adds the mod_importer_array_const_dims DSLX language test, which imports plain
and parametric structs whose member widths index an array constant.

PiperOrigin-RevId: 1023922365

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