From 1b0fb1afbcee2803152faa2fcfb1616a78ee5ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelina=20Ko=C5=9Bcielnicka?= Date: Wed, 7 Jun 2023 17:59:11 +0200 Subject: [PATCH] hdl.ast: fix `src_loc` for `Slice`. --- amaranth/hdl/ast.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amaranth/hdl/ast.py b/amaranth/hdl/ast.py index b1ba53e..669af17 100644 --- a/amaranth/hdl/ast.py +++ b/amaranth/hdl/ast.py @@ -277,12 +277,12 @@ class Value(metaclass=ABCMeta): raise IndexError(f"Index {key} is out of bounds for a {n}-bit value") if key < 0: key += n - return Slice(self, key, key + 1) + return Slice(self, key, key + 1, src_loc_at=1) elif isinstance(key, slice): start, stop, step = key.indices(n) if step != 1: return Cat(self[i] for i in range(start, stop, step)) - return Slice(self, start, stop) + return Slice(self, start, stop, src_loc_at=1) else: raise TypeError("Cannot index value with {}".format(repr(key)))