Skip to content

DSLX: Instantiating a parametric type with a named conflict causes XlsTypeError #727

@RobSpringer

Description

@RobSpringer

In one file, I have a parametric type,

pub struct SlidingWindow<NUM_ELEMENTS: u32> {
  data: Block[NUM_ELEMENTS],
  num_entries: u32,
}

in another file, I instantiate this type via

import sliding_window
type SlidingWindow = sliding_window::SlidingWindow<u32:4>;

This is fine.

But if I instead try

import sliding_window
const NUM_ENTRIES = u32:4;
type SlidingWindow = sliding_window::SlidingWindow<NUM_ENTRIES>;

I get the following error:

XlsTypeError: struct 'SlidingWindow' structure: SlidingWindow { data: uN[8][4][4][4], num_entries: uN[32] } vs struct 'SlidingWindow' structure: SlidingWindow { data: uN[8][4][4][NUM_ENTRIES], num_entries: uN[32] }: Return type of function body for 'init' did not match the annotated return type.

Looks like we're not resolving the symbolic constant to its final type at the point where we're doing this check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dslxDSLX (domain specific language) implementation / front-end

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions