Skip to content

Views with an array layout should be indexable with a slice #1405

Closed
@whitequark

Description

@whitequark

Currently this breaks (with a nicer message since c649045 / #1375) but there's no reason this can't work; it should return another ArrayLayout instead:

  File "/home/whitequark/Projects/glasgow/software/test.py", line 35, in elaborate
    m.d.sync += o_reg.eq(o_reg[1:])
                         ~~~~~^^^^
  File "/home/whitequark/Projects/glasgow/software/.venv/lib/python3.12/site-packages/amaranth/lib/data.py", line 796, in __getitem__
    raise TypeError(
TypeError: View cannot be indexed with a slice; did you mean to call `.as_value()` first?

cc @isabelburgos

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions