Separate pattern types from expression types (#5360)

This is a step toward treating patterns as compile-time constants, so
that we can import them more easily.
This commit is contained in:
Geoff Romer
2025-04-28 16:54:37 +00:00
committed by GitHub
parent 84384cf126
commit fafb655d39
565 changed files with 11956 additions and 8095 deletions
+10 -8
View File
@@ -23,6 +23,8 @@ fn G() -> i32 {
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
// CHECK:STDOUT: %array_type: type = array_type %int_3.1ba, %i32 [concrete]
// CHECK:STDOUT: %pattern_type.5d8: type = pattern_type %array_type [concrete]
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
@@ -69,12 +71,12 @@ fn G() -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
// CHECK:STDOUT: %arr.patt: %array_type = binding_pattern arr
// CHECK:STDOUT: %arr.param_patt: %array_type = value_param_pattern %arr.patt, call_param0
// CHECK:STDOUT: %i.patt: %i32 = binding_pattern i
// CHECK:STDOUT: %i.param_patt: %i32 = value_param_pattern %i.patt, call_param1
// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, call_param2
// CHECK:STDOUT: %arr.patt: %pattern_type.5d8 = binding_pattern arr
// CHECK:STDOUT: %arr.param_patt: %pattern_type.5d8 = value_param_pattern %arr.patt, call_param0
// CHECK:STDOUT: %i.patt: %pattern_type.7ce = binding_pattern i
// CHECK:STDOUT: %i.param_patt: %pattern_type.7ce = value_param_pattern %i.patt, call_param1
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param2
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc11_37: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc11_37: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
@@ -96,8 +98,8 @@ fn G() -> i32 {
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, call_param0
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]