mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add the .Self name for the type expression of a compile time binding (#5937)
We add a virtual node (`CompileTimeBindingPatternStart`) as the first child of `CompileTimeBindingPattern` which holds the identifier underneath it, so that it is checked just before the type expression of the `CompileTimeBindingPattern`. When we reach this virtual node during check, we add `.Self` as a name in the current scope, and when we reach `CompileTimeBindingPattern` we remove it from scope, which ensures it's present during only the checking of the type expression for the compile time pattern. At the moment the `.Self` has a different type (it's a `TypeType`) than other `.Self` in the facet type (which are a single `FacetType`), but the intention is to immediately substitute it out of the facet type entirely, replacing it with a reference to the compile time binding (a `BindSymbolicName`) itself. A TODO has been added for this. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
2e509e9103
commit
4b0e2b03b6
@@ -479,6 +479,7 @@ class NodeStack {
|
||||
case Parse::NodeKind::CallExprComma:
|
||||
case Parse::NodeKind::ChoiceAlternativeListComma:
|
||||
case Parse::NodeKind::CodeBlock:
|
||||
case Parse::NodeKind::CompileTimeBindingPatternStart:
|
||||
case Parse::NodeKind::ContinueStatementStart:
|
||||
case Parse::NodeKind::CorePackageName:
|
||||
case Parse::NodeKind::ExportIntroducer:
|
||||
|
||||
Reference in New Issue
Block a user