Model type expressions as regions (#4698)

This is a precondition for enabling the new pattern-matching subsystem
to support binding patterns that have `if` expressions in the type
position.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Geoff Romer
2024-12-19 21:41:06 +00:00
committed by GitHub
co-authored by Richard Smith
parent 95c9634c60
commit a112cbde5c
504 changed files with 5699 additions and 8719 deletions
+2 -4
View File
@@ -50,8 +50,8 @@ fn F() -> i32 {
// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
// CHECK:STDOUT: }
@@ -59,8 +59,6 @@ fn F() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() -> %i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_32.loc12: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc12: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %n.var: ref %i32 = var n
// CHECK:STDOUT: %n: ref %i32 = bind_name n, %n.var
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1]
@@ -44,7 +44,6 @@ fn F() {
// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template]
// CHECK:STDOUT: %struct: %struct_type.a.b.1 = struct_value (%int_1.2, %int_2.2) [template]
// CHECK:STDOUT: %ptr.2: type = ptr_type %i32 [template]
// CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template]
// CHECK:STDOUT: %tuple.type.2: type = tuple_type (%i32, %i32) [template]
// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template]
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%int_1.2, %int_2.2) [template]
@@ -71,11 +70,6 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_32.loc12_15: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc12_15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %int_32.loc12_24: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc12_24: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %struct_type.a.b.loc12: type = struct_type {.a: %i32, .b: %i32} [template = constants.%struct_type.a.b.1]
// CHECK:STDOUT: %s.var: ref %struct_type.a.b.1 = var s
// CHECK:STDOUT: %s: ref %struct_type.a.b.1 = bind_name s, %s.var
// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
@@ -98,41 +92,23 @@ fn F() {
// CHECK:STDOUT: %.loc12_46.8: init %struct_type.a.b.1 = struct_init (%.loc12_46.4, %.loc12_46.7) to %s.var [template = constants.%struct]
// CHECK:STDOUT: %.loc12_47: init %struct_type.a.b.1 = converted %.loc12_46.1, %.loc12_46.8 [template = constants.%struct]
// CHECK:STDOUT: assign %s.var, %.loc12_47
// CHECK:STDOUT: %int_32.loc14_15: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc14_15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %int_32.loc14_24: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc14_24: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %struct_type.a.b.loc14: type = struct_type {.a: %i32, .b: %i32} [template = constants.%struct_type.a.b.1]
// CHECK:STDOUT: %ptr.loc14: type = ptr_type %struct_type.a.b.1 [template = constants.%ptr.1]
// CHECK:STDOUT: %p.var: ref %ptr.1 = var p
// CHECK:STDOUT: %p: ref %ptr.1 = bind_name p, %p.var
// CHECK:STDOUT: %s.ref.loc14: ref %struct_type.a.b.1 = name_ref s, %s
// CHECK:STDOUT: %addr.loc14: %ptr.1 = addr_of %s.ref.loc14
// CHECK:STDOUT: assign %p.var, %addr.loc14
// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr.loc15: type = ptr_type %i32 [template = constants.%ptr.2]
// CHECK:STDOUT: %q.var: ref %ptr.2 = var q
// CHECK:STDOUT: %q: ref %ptr.2 = bind_name q, %q.var
// CHECK:STDOUT: %s.ref.loc15: ref %struct_type.a.b.1 = name_ref s, %s
// CHECK:STDOUT: %.loc15: ref %i32 = struct_access %s.ref.loc15, element0
// CHECK:STDOUT: %addr.loc15: %ptr.2 = addr_of %.loc15
// CHECK:STDOUT: assign %q.var, %addr.loc15
// CHECK:STDOUT: %int_32.loc16: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr.loc16: type = ptr_type %i32 [template = constants.%ptr.2]
// CHECK:STDOUT: %r.var: ref %ptr.2 = var r
// CHECK:STDOUT: %r: ref %ptr.2 = bind_name r, %r.var
// CHECK:STDOUT: %s.ref.loc16: ref %struct_type.a.b.1 = name_ref s, %s
// CHECK:STDOUT: %.loc16: ref %i32 = struct_access %s.ref.loc16, element1
// CHECK:STDOUT: %addr.loc16: %ptr.2 = addr_of %.loc16
// CHECK:STDOUT: assign %r.var, %addr.loc16
// CHECK:STDOUT: %int_32.loc18_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc18_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %int_32.loc18_16: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc18_16: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %.loc18_19.1: %tuple.type.1 = tuple_literal (%i32.loc18_11, %i32.loc18_16)
// CHECK:STDOUT: %.loc18_19.2: type = converted %.loc18_19.1, constants.%tuple.type.2 [template = constants.%tuple.type.2]
// CHECK:STDOUT: %t.var: ref %tuple.type.2 = var t
// CHECK:STDOUT: %t: ref %tuple.type.2 = bind_name t, %t.var
// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
@@ -155,9 +131,6 @@ fn F() {
// CHECK:STDOUT: %.loc18_28.6: init %tuple.type.2 = tuple_init (%.loc18_28.3, %.loc18_28.5) to %t.var [template = constants.%tuple]
// CHECK:STDOUT: %.loc18_29: init %tuple.type.2 = converted %.loc18_28.1, %.loc18_28.6 [template = constants.%tuple]
// CHECK:STDOUT: assign %t.var, %.loc18_29
// CHECK:STDOUT: %int_32.loc19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr.loc19: type = ptr_type %i32 [template = constants.%ptr.2]
// CHECK:STDOUT: %t0.var: ref %ptr.2 = var t0
// CHECK:STDOUT: %t0: ref %ptr.2 = bind_name t0, %t0.var
// CHECK:STDOUT: %t.ref.loc19: ref %tuple.type.2 = name_ref t, %t
@@ -165,9 +138,6 @@ fn F() {
// CHECK:STDOUT: %tuple.elem0.loc19: ref %i32 = tuple_access %t.ref.loc19, element0
// CHECK:STDOUT: %addr.loc19: %ptr.2 = addr_of %tuple.elem0.loc19
// CHECK:STDOUT: assign %t0.var, %addr.loc19
// CHECK:STDOUT: %int_32.loc20: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc20: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr.loc20: type = ptr_type %i32 [template = constants.%ptr.2]
// CHECK:STDOUT: %t1.var: ref %ptr.2 = var t1
// CHECK:STDOUT: %t1: ref %ptr.2 = bind_name t1, %t1.var
// CHECK:STDOUT: %t.ref.loc20: ref %tuple.type.2 = name_ref t, %t
+5 -5
View File
@@ -57,9 +57,11 @@ fn Foo(ptr: C*) {
// CHECK:STDOUT: %ptr.patt: %ptr.1 = binding_pattern ptr
// CHECK:STDOUT: %ptr.param_patt: %ptr.1 = value_param_pattern %ptr.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
// CHECK:STDOUT: %ptr.loc16_14: type = ptr_type %C [template = constants.%ptr.1]
// CHECK:STDOUT: %ptr.param: %ptr.1 = value_param runtime_param0
// CHECK:STDOUT: %.loc16: type = splice_block %ptr.loc16_14 [template = constants.%ptr.1] {
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
// CHECK:STDOUT: %ptr.loc16_14: type = ptr_type %C [template = constants.%ptr.1]
// CHECK:STDOUT: }
// CHECK:STDOUT: %ptr.loc16_8: %ptr.1 = bind_name ptr, %ptr.param
// CHECK:STDOUT: }
// CHECK:STDOUT: }
@@ -69,12 +71,10 @@ fn Foo(ptr: C*) {
// CHECK:STDOUT: %self.patt: %C = binding_pattern self
// CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
// CHECK:STDOUT: %self.param: %C = value_param runtime_param0
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
// CHECK:STDOUT: %self: %C = bind_name self, %self.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
// CHECK:STDOUT: %ptr: type = ptr_type %C [template = constants.%ptr.1]
// CHECK:STDOUT: %.loc13: %C.elem = field_decl field, element0 [template]
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.field [template = constants.%complete_type]
// CHECK:STDOUT:
+2 -7
View File
@@ -52,8 +52,8 @@ fn F() -> i32 {
// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
// CHECK:STDOUT: }
@@ -61,8 +61,6 @@ fn F() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() -> %i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_32.loc12: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc12: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %n.var: ref %i32 = var n
// CHECK:STDOUT: %n: ref %i32 = bind_name n, %n.var
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1]
@@ -72,9 +70,6 @@ fn F() -> i32 {
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_0) [template = constants.%int_0.2]
// CHECK:STDOUT: %.loc12: init %i32 = converted %int_0, %int.convert_checked [template = constants.%int_0.2]
// CHECK:STDOUT: assign %n.var, %.loc12
// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr: type = ptr_type %i32 [template = constants.%ptr]
// CHECK:STDOUT: %p.var: ref %ptr = var p
// CHECK:STDOUT: %p: ref %ptr = bind_name p, %p.var
// CHECK:STDOUT: %n.ref: ref %i32 = name_ref n, %n
@@ -193,9 +193,11 @@ fn AddressOfParam(param: i32) {
// CHECK:STDOUT: %param.patt: %i32 = binding_pattern param
// CHECK:STDOUT: %param.param_patt: %i32 = value_param_pattern %param.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc95: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc95: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %param.param: %i32 = value_param runtime_param0
// CHECK:STDOUT: %.loc95: type = splice_block %i32 [template = constants.%i32] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %param: %i32 = bind_name param, %param.param
// CHECK:STDOUT: }
// CHECK:STDOUT: }
@@ -285,9 +287,6 @@ fn AddressOfParam(param: i32) {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @AddressOfParam(%param.param_patt: %i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_32.loc99: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc99: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr: type = ptr_type %i32 [template = constants.%ptr.7]
// CHECK:STDOUT: %param_addr.var: ref %ptr.7 = var param_addr
// CHECK:STDOUT: %param_addr: ref %ptr.7 = bind_name param_addr, %param_addr.var
// CHECK:STDOUT: %param.ref: %i32 = name_ref param, %param
@@ -40,10 +40,6 @@ let n2: i32 = undeclared->foo;
// CHECK:STDOUT: .n2 = @__global_init.%n2
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %int_32.loc19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
@@ -71,9 +71,11 @@ fn Deref(n: i32) {
// CHECK:STDOUT: %n.patt: %i32 = binding_pattern n
// CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %n.param: %i32 = value_param runtime_param0
// CHECK:STDOUT: %.loc11: type = splice_block %i32 [template = constants.%i32] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param
// CHECK:STDOUT: }
// CHECK:STDOUT: }
@@ -24,8 +24,6 @@ var p2: i32->foo;
// CHECK:STDOUT: --- fail_deref_type.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -43,15 +41,8 @@ var p2: i32->foo;
// CHECK:STDOUT: .p2 = %p2
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %.loc18: ref <error> = deref %i32.loc18
// CHECK:STDOUT: %p.var: ref <error> = var p
// CHECK:STDOUT: %p: ref <error> = bind_name p, %p.var
// CHECK:STDOUT: %int_32.loc22: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %.loc22: ref <error> = deref %i32.loc22
// CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [template = <error>]
// CHECK:STDOUT: %p2.var: ref <error> = var p2
// CHECK:STDOUT: %p2: ref <error> = bind_name p2, %p2.var
// CHECK:STDOUT: }
+6 -4
View File
@@ -50,15 +50,17 @@ fn ConstMismatch(p: const {}*) -> const ({}*) {
// CHECK:STDOUT: %return.patt: %const.2 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %const.2 = out_param_pattern %return.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_28: %empty_struct_type = struct_literal ()
// CHECK:STDOUT: %.loc11_21: type = converted %.loc11_28, constants.%empty_struct_type [template = constants.%empty_struct_type]
// CHECK:STDOUT: %const.loc11_21: type = const_type %empty_struct_type [template = constants.%const.1]
// CHECK:STDOUT: %ptr.loc11_29: type = ptr_type %const.1 [template = constants.%ptr.1]
// CHECK:STDOUT: %.loc11_43: %empty_struct_type = struct_literal ()
// CHECK:STDOUT: %.loc11_44: type = converted %.loc11_43, constants.%empty_struct_type [template = constants.%empty_struct_type]
// CHECK:STDOUT: %ptr.loc11_44: type = ptr_type %empty_struct_type [template = constants.%ptr.2]
// CHECK:STDOUT: %const.loc11_35: type = const_type %ptr.2 [template = constants.%const.2]
// CHECK:STDOUT: %p.param: %ptr.1 = value_param runtime_param0
// CHECK:STDOUT: %.loc11_29: type = splice_block %ptr.loc11_29 [template = constants.%ptr.1] {
// CHECK:STDOUT: %.loc11_28: %empty_struct_type = struct_literal ()
// CHECK:STDOUT: %.loc11_21: type = converted %.loc11_28, constants.%empty_struct_type [template = constants.%empty_struct_type]
// CHECK:STDOUT: %const.loc11_21: type = const_type %empty_struct_type [template = constants.%const.1]
// CHECK:STDOUT: %ptr.loc11_29: type = ptr_type %const.1 [template = constants.%ptr.1]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %ptr.1 = bind_name p, %p.param
// CHECK:STDOUT: %return.param: ref %const.2 = out_param runtime_param1
// CHECK:STDOUT: %return: ref %const.2 = return_slot %return.param
-8
View File
@@ -53,13 +53,8 @@ var a: i32* = a_ref;
// CHECK:STDOUT: .a_ref = %a_ref
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %a_orig.var: ref %i32 = var a_orig
// CHECK:STDOUT: %a_orig: ref %i32 = bind_name a_orig, %a_orig.var
// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr: type = ptr_type %i32 [template = constants.%ptr]
// CHECK:STDOUT: %a_ref.var: ref %ptr = var a_ref
// CHECK:STDOUT: %a_ref: ref %ptr = bind_name a_ref, %a_ref.var
// CHECK:STDOUT: }
@@ -107,9 +102,6 @@ var a: i32* = a_ref;
// CHECK:STDOUT: %Implicit.import = import Implicit
// CHECK:STDOUT: %default.import = import <invalid>
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr: type = ptr_type %i32 [template = constants.%ptr]
// CHECK:STDOUT: %a.var: ref %ptr = var a
// CHECK:STDOUT: %a: ref %ptr = bind_name a, %a.var
// CHECK:STDOUT: }
+9 -7
View File
@@ -47,17 +47,19 @@ fn F(p: const (const (const i32*)*)) -> const i32 {
// CHECK:STDOUT: %return.patt: %const.1 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %const.1 = out_param_pattern %return.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc12_29: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc12_29: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %const.loc12_23: type = const_type %i32 [template = constants.%const.1]
// CHECK:STDOUT: %ptr.loc12_32: type = ptr_type %const.1 [template = constants.%ptr.1]
// CHECK:STDOUT: %const.loc12_16: type = const_type %ptr.1 [template = constants.%const.2]
// CHECK:STDOUT: %ptr.loc12_34: type = ptr_type %const.2 [template = constants.%ptr.2]
// CHECK:STDOUT: %const.loc12_9: type = const_type %ptr.2 [template = constants.%const.3]
// CHECK:STDOUT: %int_32.loc12_47: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc12_47: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %const.loc12_41: type = const_type %i32 [template = constants.%const.1]
// CHECK:STDOUT: %p.param: %const.3 = value_param runtime_param0
// CHECK:STDOUT: %.loc12: type = splice_block %const.loc12_9 [template = constants.%const.3] {
// CHECK:STDOUT: %int_32.loc12_29: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc12_29: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %const.loc12_23: type = const_type %i32 [template = constants.%const.1]
// CHECK:STDOUT: %ptr.loc12_32: type = ptr_type %const.1 [template = constants.%ptr.1]
// CHECK:STDOUT: %const.loc12_16: type = const_type %ptr.1 [template = constants.%const.2]
// CHECK:STDOUT: %ptr.loc12_34: type = ptr_type %const.2 [template = constants.%ptr.2]
// CHECK:STDOUT: %const.loc12_9: type = const_type %ptr.2 [template = constants.%const.3]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %const.3 = bind_name p, %p.param
// CHECK:STDOUT: %return.param: ref %const.1 = out_param runtime_param1
// CHECK:STDOUT: %return: ref %const.1 = return_slot %return.param
+11 -7
View File
@@ -51,13 +51,15 @@ fn ConstPtr(p: const i32*) -> (const i32)* {
// CHECK:STDOUT: %return.patt: %ptr.1 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %ptr.1 = out_param_pattern %return.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc11_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc11_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr.loc11_14: type = ptr_type %i32 [template = constants.%ptr.1]
// CHECK:STDOUT: %int_32.loc11_20: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc11_20: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr.loc11_23: type = ptr_type %i32 [template = constants.%ptr.1]
// CHECK:STDOUT: %p.param: %ptr.1 = value_param runtime_param0
// CHECK:STDOUT: %.loc11: type = splice_block %ptr.loc11_14 [template = constants.%ptr.1] {
// CHECK:STDOUT: %int_32.loc11_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc11_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %ptr.loc11_14: type = ptr_type %i32 [template = constants.%ptr.1]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %ptr.1 = bind_name p, %p.param
// CHECK:STDOUT: %return.param: ref %ptr.1 = out_param runtime_param1
// CHECK:STDOUT: %return: ref %ptr.1 = return_slot %return.param
@@ -68,15 +70,17 @@ fn ConstPtr(p: const i32*) -> (const i32)* {
// CHECK:STDOUT: %return.patt: %ptr.2 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: %ptr.2 = out_param_pattern %return.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc15_22: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc15_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %const.loc15_16: type = const_type %i32 [template = constants.%const]
// CHECK:STDOUT: %ptr.loc15_25: type = ptr_type %const [template = constants.%ptr.2]
// CHECK:STDOUT: %int_32.loc15_38: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc15_38: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %const.loc15_32: type = const_type %i32 [template = constants.%const]
// CHECK:STDOUT: %ptr.loc15_42: type = ptr_type %const [template = constants.%ptr.2]
// CHECK:STDOUT: %p.param: %ptr.2 = value_param runtime_param0
// CHECK:STDOUT: %.loc15: type = splice_block %ptr.loc15_25 [template = constants.%ptr.2] {
// CHECK:STDOUT: %int_32.loc15_22: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc15_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %const.loc15_16: type = const_type %i32 [template = constants.%const]
// CHECK:STDOUT: %ptr.loc15_25: type = ptr_type %const [template = constants.%ptr.2]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %ptr.2 = bind_name p, %p.param
// CHECK:STDOUT: %return.param: ref %ptr.2 = out_param runtime_param1
// CHECK:STDOUT: %return: ref %ptr.2 = return_slot %return.param