Open youngar opened 3 years ago
@youngar pointed me to this.
SFC is acting in accordance with the spec. MFC is actually the one not complying here:
As mention in Section 14, circuit component declarations in a module must be unique within the module’s flat namespace; this means that shadowing a component in an enclosing scope with a component of the same name inside a conditional statement is not allowed.
(FIRRTL Spec version v2.3.0
)
Ignore the commentary after the semicolon. The first part of the snippet clearly states that the module's namespace is flat. Nested scopes in FIRRTL only affect where references to circuit components are permitted. This is notably different from how scopes work in most programming languages.
This issue has been open for over a year, so it could be that the spec actually changed during this time. I tried to look back, but the spec repo was reorganized back in March of 2022 and I didn't try to look back beyond the history of the spec.md
file.
SFC doesn't just disallow name shadowing, it doesn't allow any two things to have the same name:
SFC produces an error for this:
MFC has no problem with this code.