mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
co-authored by
josh11b
Richard Smith
parent
9c7e0f6bd5
commit
37d5046ceb
@@ -761,36 +761,36 @@ var arr: array(i32, (1 as i32) + (2 as i32)) = (3, 4, (3 as i32) + (4 as i32));
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//default, Int, loaded [concrete = constants.%Int]
|
||||
// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//default, As, loaded [concrete = constants.%As.generic]
|
||||
// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc11_14, loaded [symbolic = @As.%T (constants.%T)]
|
||||
// CHECK:STDOUT: %Core.import_ref.a7c = import_ref Core//default, inst103 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.a7c = import_ref Core//default, inst104 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.5e1: @As.%As.assoc_type (%As.assoc_type.760) = import_ref Core//default, loc12_32, loaded [symbolic = @As.%assoc0 (constants.%assoc0.97d)]
|
||||
// CHECK:STDOUT: %Core.Convert.313 = import_ref Core//default, Convert, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc11_14, loaded [symbolic = @As.%T (constants.%T)]
|
||||
// CHECK:STDOUT: %Core.import_ref.996: @As.%As.type (%As.type.eed) = import_ref Core//default, inst103 [no loc], loaded [symbolic = @As.%Self (constants.%Self.65a)]
|
||||
// CHECK:STDOUT: %Core.import_ref.996: @As.%As.type (%As.type.eed) = import_ref Core//default, inst104 [no loc], loaded [symbolic = @As.%Self (constants.%Self.65a)]
|
||||
// CHECK:STDOUT: %Core.import_ref.708: @As.%As.Convert.type (%As.Convert.type.843) = import_ref Core//default, loc12_32, loaded [symbolic = @As.%As.Convert (constants.%As.Convert.95f)]
|
||||
// CHECK:STDOUT: %Core.import_ref.4e8 = import_ref Core//default, loc12_32, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.5ab3ec.3: type = import_ref Core//default, loc7_19, loaded [symbolic = @AddWith.%T (constants.%T)]
|
||||
// CHECK:STDOUT: %Core.import_ref.476 = import_ref Core//default, inst49 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.476 = import_ref Core//default, inst50 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.35d: @AddWith.%AddWith.assoc_type (%AddWith.assoc_type.c10) = import_ref Core//default, loc8_41, loaded [symbolic = @AddWith.%assoc0 (constants.%assoc0.89962d.2)]
|
||||
// CHECK:STDOUT: %Core.Op = import_ref Core//default, Op, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.772: <witness> = import_ref Core//default, loc19_26, loaded [concrete = constants.%AddWith.impl_witness]
|
||||
// CHECK:STDOUT: %Core.import_ref.c8c7cd.1: type = import_ref Core//default, loc19_6, loaded [concrete = constants.%i32.builtin]
|
||||
// CHECK:STDOUT: %Core.import_ref.ef3: type = import_ref Core//default, loc19_24, loaded [concrete = constants.%AddWith.type.6f5]
|
||||
// CHECK:STDOUT: %Core.import_ref.5ab3ec.4: type = import_ref Core//default, loc7_19, loaded [symbolic = @AddWith.%T (constants.%T)]
|
||||
// CHECK:STDOUT: %Core.import_ref.6bf: @AddWith.%AddWith.type (%AddWith.type.6d3) = import_ref Core//default, inst49 [no loc], loaded [symbolic = @AddWith.%Self (constants.%Self.6c1)]
|
||||
// CHECK:STDOUT: %Core.import_ref.6bf: @AddWith.%AddWith.type (%AddWith.type.6d3) = import_ref Core//default, inst50 [no loc], loaded [symbolic = @AddWith.%Self (constants.%Self.6c1)]
|
||||
// CHECK:STDOUT: %Core.import_ref.7e6ace.1 = import_ref Core//default, loc8_41, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.1b9: @AddWith.%AddWith.Op.type (%AddWith.Op.type.22d) = import_ref Core//default, loc8_41, loaded [symbolic = @AddWith.%AddWith.Op (constants.%AddWith.Op.965)]
|
||||
// CHECK:STDOUT: %Core.import_ref.cb6: <witness> = import_ref Core//default, loc23_30, loaded [concrete = constants.%As.impl_witness]
|
||||
// CHECK:STDOUT: %Core.import_ref.8721d7.1: type = import_ref Core//default, loc23_17, loaded [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: %Core.import_ref.1e5: type = import_ref Core//default, loc23_28, loaded [concrete = constants.%As.type.a6d]
|
||||
// CHECK:STDOUT: %Core.import_ref.5ab3ec.5: type = import_ref Core//default, loc15_22, loaded [symbolic = @ImplicitAs.%T (constants.%T)]
|
||||
// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst147 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst148 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0) = import_ref Core//default, loc16_32, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc001e.2)]
|
||||
// CHECK:STDOUT: %Core.Convert.e69 = import_ref Core//default, Convert, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.c62: <witness> = import_ref Core//default, loc27_38, loaded [concrete = constants.%ImplicitAs.impl_witness.07a]
|
||||
// CHECK:STDOUT: %Core.import_ref.8721d7.2: type = import_ref Core//default, loc27_17, loaded [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: %Core.import_ref.4d9: type = import_ref Core//default, loc27_36, loaded [concrete = constants.%ImplicitAs.type.61e]
|
||||
// CHECK:STDOUT: %Core.import_ref.5ab3ec.6: type = import_ref Core//default, loc15_22, loaded [symbolic = @ImplicitAs.%T (constants.%T)]
|
||||
// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst147 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)]
|
||||
// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst148 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)]
|
||||
// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc16_32, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.1c752f.1: @ImplicitAs.%ImplicitAs.Convert.type (%ImplicitAs.Convert.type.275) = import_ref Core//default, loc16_32, loaded [symbolic = @ImplicitAs.%ImplicitAs.Convert (constants.%ImplicitAs.Convert.42e)]
|
||||
// CHECK:STDOUT: %Core.import_ref.c5f: <witness> = import_ref Core//default, loc31_38, loaded [concrete = constants.%ImplicitAs.impl_witness.9c5]
|
||||
|
||||
+4
-4
@@ -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: }
|
||||
|
||||
@@ -534,7 +534,7 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: %Main.C: type = import_ref Main//two_file, C, loaded [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %Main.D: type = import_ref Main//two_file, D, loaded [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//two_file, loc4_10, loaded [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//two_file, inst16 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//two_file, inst17 [no loc], unloaded
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -872,7 +872,7 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Main.C: type = import_ref Main//alias_two_file, C, loaded [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//alias_two_file, loc4_10, loaded [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//alias_two_file, inst16 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//alias_two_file, inst17 [no loc], unloaded
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ fn B() {
|
||||
// CHECK:STDOUT: import Lib//default
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Lib.Z: type = import_ref Lib//default, Z, loaded [concrete = constants.%Z.type]
|
||||
// CHECK:STDOUT: %Lib.import_ref.f88 = import_ref Lib//default, inst17 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Lib.import_ref.f88 = import_ref Lib//default, inst18 [no loc], unloaded
|
||||
// CHECK:STDOUT: %Lib.A: %A.type.fad = import_ref Lib//default, A, loaded [concrete = constants.%A.7a0]
|
||||
// CHECK:STDOUT: %Lib.import_ref.be7: %Z.type = import_ref Lib//default, loc4_6, loaded [symbolic = @A.1.%T (constants.%T)]
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user