mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 21:06:41 +00:00
Detect impl redecls in non-declarative scopes (#7170)
Avoid crashing on the fact that block scopes have no related InstId. So we can't push the InstId of the current scope in the ImplIntroducer node, as it can be None. Instead we have to find the parent InstId when we're building the ImplDecl, because the ImplDecl has a node at the top of the scope stack for the DeclNameStack. Impls are allowed in sequential (non-declarative) scopes (functions, blocks), but [redeclarations are not allowed](https://github.com/carbon-language/carbon-lang/blob/db24042fe56d22275aa801696e2f8f5c4171e35b/proposals/p3763.md?plain=1#L279). We now diagnose these redecls as invalid.
This commit is contained in:
1 parent
daebbf32fa
commit
6776e2b804
9 files changed
+266
-417
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "common/check.h"
|
||||
#include "common/find.h"
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/unused.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
|
||||
Reference in new issue
Block a user