mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:41:04 +01:00
Avoid symbolic witnesses for .Self in an impl decl (#7564)
Point symbolic witnesses into `.Self` written inside an impl decl at the impl that is being declared. This is tricky because the impl does not yet exist. So we use a new instruction `ImplSelfWitness` which _will_ be replaced by the `ImplWitness` once it becomes available. The `ImplSelfWitness` acts like a symbolic witness, except it does not perform lookup, since we know which impl we will get a witness from. This prevents us from finding other impls when performing lookups into `.Self` in an impl decl, which produces incorrect/incoherent results.
This commit is contained in:
@@ -481,7 +481,6 @@ class NodeStack {
|
||||
case Parse::NodeKind::VariableIntroducer:
|
||||
case Parse::NodeKind::InlineImportBody:
|
||||
case Parse::NodeKind::InlineIntroducer:
|
||||
case Parse::NodeKind::WhereOperand:
|
||||
return Id::Kind::None;
|
||||
case Parse::NodeKind::AdaptIntroducer:
|
||||
case Parse::NodeKind::AliasInitializer:
|
||||
@@ -543,6 +542,7 @@ class NodeStack {
|
||||
case Parse::NodeKind::StructTypeLiteralComma:
|
||||
case Parse::NodeKind::TerseBodyArrow:
|
||||
case Parse::NodeKind::TupleLiteralComma:
|
||||
case Parse::NodeKind::WhereOperand:
|
||||
case Parse::NodeKind::WhileCondition:
|
||||
return Id::Kind::Invalid;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user