Support parse/check/lower for char (#5901)

toolchain/check/testdata/builtins/char/basics.carbon and
toolchain/lower/testdata/builtins/char.carbon are probably the most
interesting tests here. The parse tests is required because this adds a
new node kind, and we need coverage of it; but the attached info is
minor. There's a fair amount of test churn here because I'm adding the
Core.Char and Core.CharLiteral types as new singletons.

My intent here is that `CharId` is always a unicode code point, even
when the type is a `Char` and thus must be a single UTF-8 code unit
(single byte). This mainly means the stored value of a `CharValue` can
be printed internally without knowing the type.

---------

Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Jon Ross-Perkins
2025-08-06 20:39:01 +00:00
committed by GitHub
co-authored by josh11b Richard Smith
parent 9c7e0f6bd5
commit 37d5046ceb
109 changed files with 1520 additions and 1077 deletions
@@ -262,13 +262,13 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//incomplete_return, loc37_10, loaded [concrete = constants.%complete_type]
// CHECK:STDOUT: %Main.import_ref.cabe25.1 = import_ref Main//incomplete_return, inst20 [no loc], unloaded
// CHECK:STDOUT: %Main.import_ref.cabe25.1 = import_ref Main//incomplete_return, inst21 [no loc], unloaded
// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
// CHECK:STDOUT: %Main.import_ref.7ba: <witness> = import_ref Main//incomplete_return, loc37_9, loaded [concrete = constants.%Destroy.impl_witness.b6f]
// CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//incomplete_return, loc37_10, loaded [concrete = constants.%complete_type]
// CHECK:STDOUT: %Main.import_ref.cabe25.2 = import_ref Main//incomplete_return, inst20 [no loc], unloaded
// CHECK:STDOUT: %Main.import_ref.4aa: type = import_ref Main//incomplete_return, inst20 [no loc], loaded [concrete = constants.%D.b3dde2.1]
// CHECK:STDOUT: %Main.import_ref.cb9: type = import_ref Main//incomplete_return, inst67 [no loc], loaded [concrete = constants.%Destroy.type]
// CHECK:STDOUT: %Main.import_ref.cabe25.2 = import_ref Main//incomplete_return, inst21 [no loc], unloaded
// CHECK:STDOUT: %Main.import_ref.4aa: type = import_ref Main//incomplete_return, inst21 [no loc], loaded [concrete = constants.%D.b3dde2.1]
// CHECK:STDOUT: %Main.import_ref.cb9: type = import_ref Main//incomplete_return, inst68 [no loc], loaded [concrete = constants.%Destroy.type]
// CHECK:STDOUT: %Main.import_ref.283: %D.as.Destroy.impl.Op.type = import_ref Main//incomplete_return, loc37_9, loaded [concrete = constants.%D.as.Destroy.impl.Op]
// CHECK:STDOUT: %Destroy.impl_witness_table.cd7 = impl_witness_table (%Main.import_ref.283), @D.as.Destroy.impl [concrete]
// CHECK:STDOUT: }