mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 18:05:02 +01:00
Factor out logic to evaluate `EntityNameId` instead of duplicating it between `BindSymbolicName` and `SymbolicBindingPattern`. Remove support in `SymbolicBindingPattern` for evaluating a pattern to the constant value of the corresponding binding, which doesn't really make any sense given that patterns don't generally evaluate to the value that they matched. This results in the handling for `SymbolicBindingPattern` being simply the default handling for an always-constant instruction, so remove the special case for it entirely and change its constant kind to `Always`. It's not entirely clear that it makes sense for `SymbolicBindingPattern` to be treated as a constant when other patterns aren't, but we seem to be relying on this in various places, so leave it as a constant for now. Changing it to never be constant will be a smaller change now -- it just requires changing the `constant_kind`. The IR changes in the tests are fairly widespread, but mechanical, and there are two kinds of things changing: - `symbolic_binding_pattern`s in specifics now evaluate to `symbolic_binding_pattern`s, not to the argument values. This means in a few cases we end up with additional `symbolic_binding_pattern` constants. - We evaluate the type operand of `symbolic_binding_pattern` now, so an error in the type will now properly be propagated into an error in the pattern's constant value.