If submodules have the same output signal name, a conflict occurs. Because of this, the submodule itself must guard against such situations by generating a unique name (for example, using addOutput('out_${Logic().name}')).
Clearly, it was my fault. The problem was in the Nand2Gate constructor, namely that addInput used the names of input signals, which led to a conflict when receiving a signal named out.
Describe the bug
If submodules have the same output signal name, a conflict occurs. Because of this, the submodule itself must guard against such situations by generating a unique name (for example, using
addOutput('out_${Logic().name}')
).To Reproduce
The problem is in the
Nand2Gate
module.DartPad: https://dartpad.dev/?id=a384202f85517f4bc0191122a5ad180c
Expected behavior
A submodule can be used in any module without having to provide unique names.
Actual behavior
The submodule developer is required to provide unique names.
Additional: Dart SDK info
No response
Additional: pubspec.yaml
No response
Additional: Context
No response