mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 12:01:05 +01:00
Uses of `ConstantValueStore::GetConstantInstId` or `ConstantValueStore::GetInstId` in eval indicate that the code expects a constant value. Instead of just ending up with `None` in strange places, diagnose this and convert to an `ErrorInst` when expectations are not met. We add `RequireConstantValue` to pair with `GetConstantValue`, and rename `GetConstantValueIgnoringPeriodSelf` to `RequireConstantValueIgnoringPeriodSelf` since the former would just be unused. Adds a test where a runtime value ends up in the RHS of a rewrite constraint, where a constant value is expected. This issue was uncovered by a fuzzer. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>