mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
If a keyword or a sized type literal (eg, `f2`) is used in a context where we are confident that we are expecting an identifier -- either before a `:` in a binding pattern or after a `.` in a member access or designator -- then recover as if a raw identifier was used. This appears to be a particular stumbling block for coding agents, so seems worth paying special attention to. Add a mechanism to the tokenized buffer to track additional tokens synthesized for error recovery so that we can keep the lexed token sequence immutable and still satisfy the invariants throughout the rest of the toolchain for recovery tokens. Thanks to chandlerc for suggesting this approach!