[Pattern] improve error message when attempting to reference a Pattern

This commit is contained in:
jan 2026-03-10 00:31:58 -07:00
commit 2275bf415a

View file

@ -1576,8 +1576,9 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
self._log_port_removal(ki)
map_out[vi] = None
if isinstance(other, Pattern):
assert append or skip_geometry, 'Got a name (not an abstract) but was asked to reference (not append)'
if isinstance(other, Pattern) and not (append or skip_geometry):
raise PatternError('Must provide an `Abstract` (not a `Pattern`) when creating a reference. '
'Use `append=True` if you intended to append the full geometry.')
self.place(
other,