mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:44:55 +01:00
Promote FunctionType to a standard instruction. (#3931)
This removes the builtin FunctionType, replacing it with a FunctionType instruction. The constant for a FunctionDecl is now a StructValue with type of FunctionType. Note this means a function declaration produces _both_ a type, and a value of the type. This has some consequences in terms of circularity, and makes the importing of function declarations a little more complex. It'll get particularly peculiar for imports because of the behavior of the reference, but that's a known issue due to other things such as `alias`. The impact will hopefully be contained to ResolvePrevInstForMerge (and ImportRefs). To note a small formatting change in diagnostics: ``` - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated <function> in Interface>` is not callable. + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated F in Interface>` is not callable. - // CHECK:STDERR: fail_todo_facet_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated <function> in Interface>` is not callable. + // CHECK:STDERR: fail_todo_facet_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated F in Interface>` is not callable. ``` --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
e6061f6910
commit
76ed3c73cb
@@ -12,17 +12,20 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: --- address_of_deref.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.2: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %F: type = fn_type @F [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct: F = struct_value () [template]
|
||||
// CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
|
||||
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
|
||||
// CHECK:STDOUT: @F.%return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
@@ -31,7 +34,7 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %n.var: ref i32 = var n
|
||||
// CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var
|
||||
// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2]
|
||||
// CHECK:STDOUT: assign %n.var, %.loc8
|
||||
// CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n
|
||||
// CHECK:STDOUT: %.loc9_13: i32* = addr_of %n.ref
|
||||
|
||||
+36
-33
@@ -19,58 +19,61 @@ fn F() {
|
||||
// CHECK:STDOUT: --- address_of_lvalue.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template]
|
||||
// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template]
|
||||
// CHECK:STDOUT: %.3: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template]
|
||||
// CHECK:STDOUT: %.5: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %.6: type = tuple_type (type, type) [template]
|
||||
// CHECK:STDOUT: %.7: type = tuple_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.8: type = ptr_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.3, %.4) [template]
|
||||
// CHECK:STDOUT: %.9: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %F: type = fn_type @F [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
|
||||
// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template]
|
||||
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.5: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template]
|
||||
// CHECK:STDOUT: %.6: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %.7: type = tuple_type (type, type) [template]
|
||||
// CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.9: type = ptr_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template]
|
||||
// CHECK:STDOUT: %.10: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
|
||||
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2]
|
||||
// CHECK:STDOUT: %s.var: ref {.a: i32, .b: i32} = var s
|
||||
// CHECK:STDOUT: %s: ref {.a: i32, .b: i32} = bind_name s, %s.var
|
||||
// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc8_46.1: {.a: i32, .b: i32} = struct_literal (%.loc8_37, %.loc8_45)
|
||||
// CHECK:STDOUT: %.loc8_46.2: ref i32 = struct_access %s.var, element0
|
||||
// CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc8_46.4: ref i32 = struct_access %s.var, element1
|
||||
// CHECK:STDOUT: %.loc8_46.5: init i32 = initialize_from %.loc8_45 to %.loc8_46.4 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var [template = constants.%struct]
|
||||
// CHECK:STDOUT: %.loc8_47: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 [template = constants.%struct]
|
||||
// CHECK:STDOUT: %.loc8_46.5: init i32 = initialize_from %.loc8_45 to %.loc8_46.4 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var [template = constants.%struct.2]
|
||||
// CHECK:STDOUT: %.loc8_47: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 [template = constants.%struct.2]
|
||||
// CHECK:STDOUT: assign %s.var, %.loc8_47
|
||||
// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.3]
|
||||
// CHECK:STDOUT: %p.var: ref {.a: i32, .b: i32}* = var p
|
||||
// CHECK:STDOUT: %p: ref {.a: i32, .b: i32}* = bind_name p, %p.var
|
||||
// CHECK:STDOUT: %s.ref.loc10: ref {.a: i32, .b: i32} = name_ref s, %s
|
||||
// CHECK:STDOUT: %.loc10_32: {.a: i32, .b: i32}* = addr_of %s.ref.loc10
|
||||
// CHECK:STDOUT: assign %p.var, %.loc10_32
|
||||
// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %q.var: ref i32* = var q
|
||||
// CHECK:STDOUT: %q: ref i32* = bind_name q, %q.var
|
||||
// CHECK:STDOUT: %s.ref.loc11: ref {.a: i32, .b: i32} = name_ref s, %s
|
||||
// CHECK:STDOUT: %.loc11_19: ref i32 = struct_access %s.ref.loc11, element0
|
||||
// CHECK:STDOUT: %.loc11_17: i32* = addr_of %.loc11_19
|
||||
// CHECK:STDOUT: assign %q.var, %.loc11_17
|
||||
// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %r.var: ref i32* = var r
|
||||
// CHECK:STDOUT: %r: ref i32* = bind_name r, %r.var
|
||||
// CHECK:STDOUT: %s.ref.loc12: ref {.a: i32, .b: i32} = name_ref s, %s
|
||||
@@ -78,32 +81,32 @@ fn F() {
|
||||
// CHECK:STDOUT: %.loc12_17: i32* = addr_of %.loc12_19
|
||||
// CHECK:STDOUT: assign %r.var, %.loc12_17
|
||||
// CHECK:STDOUT: %.loc14_19.1: (type, type) = tuple_literal (i32, i32)
|
||||
// CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.7 [template = constants.%.7]
|
||||
// CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.8 [template = constants.%.8]
|
||||
// CHECK:STDOUT: %t.var: ref (i32, i32) = var t
|
||||
// CHECK:STDOUT: %t: ref (i32, i32) = bind_name t, %t.var
|
||||
// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc14_28.1: (i32, i32) = tuple_literal (%.loc14_24, %.loc14_27)
|
||||
// CHECK:STDOUT: %.loc14_28.2: ref i32 = tuple_access %t.var, element0
|
||||
// CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_24 to %.loc14_28.2 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_24 to %.loc14_28.2 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc14_28.4: ref i32 = tuple_access %t.var, element1
|
||||
// CHECK:STDOUT: %.loc14_28.5: init i32 = initialize_from %.loc14_27 to %.loc14_28.4 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc14_28.5: init i32 = initialize_from %.loc14_27 to %.loc14_28.4 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc14_28.6: init (i32, i32) = tuple_init (%.loc14_28.3, %.loc14_28.5) to %t.var [template = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc14_29: init (i32, i32) = converted %.loc14_28.1, %.loc14_28.6 [template = constants.%tuple]
|
||||
// CHECK:STDOUT: assign %t.var, %.loc14_29
|
||||
// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %t0.var: ref i32* = var t0
|
||||
// CHECK:STDOUT: %t0: ref i32* = bind_name t0, %t0.var
|
||||
// CHECK:STDOUT: %t.ref.loc15: ref (i32, i32) = name_ref t, %t
|
||||
// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc15_22: ref i32 = tuple_index %t.ref.loc15, %.loc15_21
|
||||
// CHECK:STDOUT: %.loc15_18: i32* = addr_of %.loc15_22
|
||||
// CHECK:STDOUT: assign %t0.var, %.loc15_18
|
||||
// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %t1.var: ref i32* = var t1
|
||||
// CHECK:STDOUT: %t1: ref i32* = bind_name t1, %t1.var
|
||||
// CHECK:STDOUT: %t.ref.loc16: ref (i32, i32) = name_ref t, %t
|
||||
// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc16_22: ref i32 = tuple_index %t.ref.loc16, %.loc16_21
|
||||
// CHECK:STDOUT: %.loc16_18: i32* = addr_of %.loc16_22
|
||||
// CHECK:STDOUT: assign %t1.var, %.loc16_18
|
||||
|
||||
+19
-15
@@ -23,42 +23,46 @@ fn Foo(ptr: C*) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %C: type = class_type @C [template]
|
||||
// CHECK:STDOUT: %.1: type = ptr_type C [template]
|
||||
// CHECK:STDOUT: %.2: type = unbound_element_type C, C* [template]
|
||||
// CHECK:STDOUT: %.3: type = struct_type {.field: C*} [template]
|
||||
// CHECK:STDOUT: %.4: type = ptr_type {.field: C*} [template]
|
||||
// CHECK:STDOUT: %.5: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %Member: type = fn_type @Member [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct.1: Member = struct_value () [template]
|
||||
// CHECK:STDOUT: %.2: type = ptr_type C [template]
|
||||
// CHECK:STDOUT: %.3: type = unbound_element_type C, C* [template]
|
||||
// CHECK:STDOUT: %.4: type = struct_type {.field: C*} [template]
|
||||
// CHECK:STDOUT: %Foo: type = fn_type @Foo [template]
|
||||
// CHECK:STDOUT: %struct.2: Foo = struct_value () [template]
|
||||
// CHECK:STDOUT: %.5: type = ptr_type {.field: C*} [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .C = %C.decl
|
||||
// CHECK:STDOUT: .Foo = %Foo
|
||||
// CHECK:STDOUT: .Foo = %Foo.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
|
||||
// CHECK:STDOUT: %Foo: <function> = fn_decl @Foo [template] {
|
||||
// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %.loc12: type = ptr_type C [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc12: type = ptr_type C [template = constants.%.2]
|
||||
// CHECK:STDOUT: %ptr.loc12_8.1: C* = param ptr
|
||||
// CHECK:STDOUT: @Foo.%ptr: C* = bind_name ptr, %ptr.loc12_8.1
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @C {
|
||||
// CHECK:STDOUT: %Member: <function> = fn_decl @Member [template] {
|
||||
// CHECK:STDOUT: %Member.decl: Member = fn_decl @Member [template = constants.%struct.1] {
|
||||
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
|
||||
// CHECK:STDOUT: %self.loc8_13.1: C = param self
|
||||
// CHECK:STDOUT: %self.loc8_13.2: C = bind_name self, %self.loc8_13.1
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %.loc9_15: type = ptr_type C [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc9_15: type = ptr_type C [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc9_12: <unbound element of class C> = field_decl field, element0 [template]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%C
|
||||
// CHECK:STDOUT: .Member = %Member
|
||||
// CHECK:STDOUT: .Member = %Member.decl
|
||||
// CHECK:STDOUT: .field = %.loc9_12
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -68,16 +72,16 @@ fn Foo(ptr: C*) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %ptr.ref.loc13: C* = name_ref ptr, %ptr
|
||||
// CHECK:STDOUT: %.loc13_4.1: ref C = deref %ptr.ref.loc13
|
||||
// CHECK:STDOUT: %Member.ref.loc13: <function> = name_ref Member, @C.%Member [template = @C.%Member]
|
||||
// CHECK:STDOUT: %Member.ref.loc13: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1]
|
||||
// CHECK:STDOUT: %.loc13_9: <bound method> = bound_method %.loc13_4.1, %Member.ref.loc13
|
||||
// CHECK:STDOUT: %.loc13_4.2: C = bind_value %.loc13_4.1
|
||||
// CHECK:STDOUT: %.loc13_16: init () = call %.loc13_9(%.loc13_4.2)
|
||||
// CHECK:STDOUT: %Member.call.loc13: init () = call %.loc13_9(%.loc13_4.2)
|
||||
// CHECK:STDOUT: %ptr.ref.loc14: C* = name_ref ptr, %ptr
|
||||
// CHECK:STDOUT: %.loc14_6.1: ref C = deref %ptr.ref.loc14
|
||||
// CHECK:STDOUT: %Member.ref.loc14: <function> = name_ref Member, @C.%Member [template = @C.%Member]
|
||||
// CHECK:STDOUT: %Member.ref.loc14: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1]
|
||||
// CHECK:STDOUT: %.loc14_6.2: <bound method> = bound_method %.loc14_6.1, %Member.ref.loc14
|
||||
// CHECK:STDOUT: %.loc14_6.3: C = bind_value %.loc14_6.1
|
||||
// CHECK:STDOUT: %.loc14_14: init () = call %.loc14_6.2(%.loc14_6.3)
|
||||
// CHECK:STDOUT: %Member.call.loc14: init () = call %.loc14_6.2(%.loc14_6.3)
|
||||
// CHECK:STDOUT: %ptr.ref.loc16: C* = name_ref ptr, %ptr
|
||||
// CHECK:STDOUT: %.loc16_4: ref C = deref %ptr.ref.loc16
|
||||
// CHECK:STDOUT: %field.ref.loc16: <unbound element of class C> = name_ref field, @C.%.loc9_12 [template = @C.%.loc9_12]
|
||||
|
||||
+9
-6
@@ -14,17 +14,20 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: --- basic.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.2: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %F: type = fn_type @F [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct: F = struct_value () [template]
|
||||
// CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
|
||||
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
|
||||
// CHECK:STDOUT: @F.%return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
@@ -33,9 +36,9 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %n.var: ref i32 = var n
|
||||
// CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var
|
||||
// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2]
|
||||
// CHECK:STDOUT: assign %n.var, %.loc8
|
||||
// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %p.var: ref i32* = var p
|
||||
// CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var
|
||||
// CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n
|
||||
|
||||
@@ -22,13 +22,19 @@ fn Test() {
|
||||
|
||||
// CHECK:STDOUT: --- fail_address_of_error.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Test: type = fn_type @Test [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct: Test = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .Test = %Test
|
||||
// CHECK:STDOUT: .Test = %Test.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %Test: <function> = fn_decl @Test [template] {}
|
||||
// CHECK:STDOUT: %Test.decl: Test = fn_decl @Test [template = constants.%struct] {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Test() {
|
||||
|
||||
+76
-59
@@ -98,54 +98,71 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT: --- fail_address_of_value.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template]
|
||||
// CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %.4: bool = bool_literal true [template]
|
||||
// CHECK:STDOUT: %.5: type = ptr_type bool [template]
|
||||
// CHECK:STDOUT: %.6: f64 = float_literal 1 [template]
|
||||
// CHECK:STDOUT: %.7: type = ptr_type f64 [template]
|
||||
// CHECK:STDOUT: %.8: type = ptr_type String [template]
|
||||
// CHECK:STDOUT: %.9: String = string_literal "Hello" [template]
|
||||
// CHECK:STDOUT: %.10: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.11: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.12: type = tuple_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.13: type = ptr_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.14: i32 = int_literal 5 [template]
|
||||
// CHECK:STDOUT: %.15: type = ptr_type {.a: i32} [template]
|
||||
// CHECK:STDOUT: %.16: bool = bool_literal false [template]
|
||||
// CHECK:STDOUT: %.17: type = ptr_type type [template]
|
||||
// CHECK:STDOUT: %.18: type = const_type i32 [template]
|
||||
// CHECK:STDOUT: %.19: type = ptr_type const i32 [template]
|
||||
// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.10, %.11) [template]
|
||||
// CHECK:STDOUT: %G: type = fn_type @G [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct.1: G = struct_value () [template]
|
||||
// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template]
|
||||
// CHECK:STDOUT: %H: type = fn_type @H [template]
|
||||
// CHECK:STDOUT: %struct.2: H = struct_value () [template]
|
||||
// CHECK:STDOUT: %AddressOfLiteral: type = fn_type @AddressOfLiteral [template]
|
||||
// CHECK:STDOUT: %struct.3: AddressOfLiteral = struct_value () [template]
|
||||
// CHECK:STDOUT: %.3: i32 = int_literal 0 [template]
|
||||
// CHECK:STDOUT: %.4: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %.5: bool = bool_literal true [template]
|
||||
// CHECK:STDOUT: %.6: type = ptr_type bool [template]
|
||||
// CHECK:STDOUT: %.7: f64 = float_literal 1 [template]
|
||||
// CHECK:STDOUT: %.8: type = ptr_type f64 [template]
|
||||
// CHECK:STDOUT: %.9: type = ptr_type String [template]
|
||||
// CHECK:STDOUT: %.10: String = string_literal "Hello" [template]
|
||||
// CHECK:STDOUT: %.11: i32 = int_literal 1 [template]
|
||||
// CHECK:STDOUT: %.12: i32 = int_literal 2 [template]
|
||||
// CHECK:STDOUT: %.13: type = tuple_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.14: type = ptr_type (i32, i32) [template]
|
||||
// CHECK:STDOUT: %.15: i32 = int_literal 5 [template]
|
||||
// CHECK:STDOUT: %.16: type = ptr_type {.a: i32} [template]
|
||||
// CHECK:STDOUT: %AddressOfOperator: type = fn_type @AddressOfOperator [template]
|
||||
// CHECK:STDOUT: %struct.4: AddressOfOperator = struct_value () [template]
|
||||
// CHECK:STDOUT: %.17: bool = bool_literal false [template]
|
||||
// CHECK:STDOUT: %AddressOfCall: type = fn_type @AddressOfCall [template]
|
||||
// CHECK:STDOUT: %struct.5: AddressOfCall = struct_value () [template]
|
||||
// CHECK:STDOUT: %AddressOfType: type = fn_type @AddressOfType [template]
|
||||
// CHECK:STDOUT: %struct.6: AddressOfType = struct_value () [template]
|
||||
// CHECK:STDOUT: %.18: type = ptr_type type [template]
|
||||
// CHECK:STDOUT: %.19: type = const_type i32 [template]
|
||||
// CHECK:STDOUT: %.20: type = ptr_type const i32 [template]
|
||||
// CHECK:STDOUT: %AddressOfTupleElementValue: type = fn_type @AddressOfTupleElementValue [template]
|
||||
// CHECK:STDOUT: %struct.7: AddressOfTupleElementValue = struct_value () [template]
|
||||
// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.11, %.12) [template]
|
||||
// CHECK:STDOUT: %AddressOfParam: type = fn_type @AddressOfParam [template]
|
||||
// CHECK:STDOUT: %struct.8: AddressOfParam = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .G = %G
|
||||
// CHECK:STDOUT: .H = %H
|
||||
// CHECK:STDOUT: .AddressOfLiteral = %AddressOfLiteral
|
||||
// CHECK:STDOUT: .AddressOfOperator = %AddressOfOperator
|
||||
// CHECK:STDOUT: .AddressOfCall = %AddressOfCall
|
||||
// CHECK:STDOUT: .AddressOfType = %AddressOfType
|
||||
// CHECK:STDOUT: .AddressOfTupleElementValue = %AddressOfTupleElementValue
|
||||
// CHECK:STDOUT: .AddressOfParam = %AddressOfParam
|
||||
// CHECK:STDOUT: .G = %G.decl
|
||||
// CHECK:STDOUT: .H = %H.decl
|
||||
// CHECK:STDOUT: .AddressOfLiteral = %AddressOfLiteral.decl
|
||||
// CHECK:STDOUT: .AddressOfOperator = %AddressOfOperator.decl
|
||||
// CHECK:STDOUT: .AddressOfCall = %AddressOfCall.decl
|
||||
// CHECK:STDOUT: .AddressOfType = %AddressOfType.decl
|
||||
// CHECK:STDOUT: .AddressOfTupleElementValue = %AddressOfTupleElementValue.decl
|
||||
// CHECK:STDOUT: .AddressOfParam = %AddressOfParam.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %G: <function> = fn_decl @G [template] {
|
||||
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] {
|
||||
// CHECK:STDOUT: @G.%return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %H: <function> = fn_decl @H [template] {
|
||||
// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} [template = constants.%.1]
|
||||
// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.2] {
|
||||
// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} [template = constants.%.2]
|
||||
// CHECK:STDOUT: @H.%return: ref {.a: i32} = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %AddressOfLiteral: <function> = fn_decl @AddressOfLiteral [template] {}
|
||||
// CHECK:STDOUT: %AddressOfOperator: <function> = fn_decl @AddressOfOperator [template] {}
|
||||
// CHECK:STDOUT: %AddressOfCall: <function> = fn_decl @AddressOfCall [template] {}
|
||||
// CHECK:STDOUT: %AddressOfType: <function> = fn_decl @AddressOfType [template] {}
|
||||
// CHECK:STDOUT: %AddressOfTupleElementValue: <function> = fn_decl @AddressOfTupleElementValue [template] {}
|
||||
// CHECK:STDOUT: %AddressOfParam: <function> = fn_decl @AddressOfParam [template] {
|
||||
// CHECK:STDOUT: %AddressOfLiteral.decl: AddressOfLiteral = fn_decl @AddressOfLiteral [template = constants.%struct.3] {}
|
||||
// CHECK:STDOUT: %AddressOfOperator.decl: AddressOfOperator = fn_decl @AddressOfOperator [template = constants.%struct.4] {}
|
||||
// CHECK:STDOUT: %AddressOfCall.decl: AddressOfCall = fn_decl @AddressOfCall [template = constants.%struct.5] {}
|
||||
// CHECK:STDOUT: %AddressOfType.decl: AddressOfType = fn_decl @AddressOfType [template = constants.%struct.6] {}
|
||||
// CHECK:STDOUT: %AddressOfTupleElementValue.decl: AddressOfTupleElementValue = fn_decl @AddressOfTupleElementValue [template = constants.%struct.7] {}
|
||||
// CHECK:STDOUT: %AddressOfParam.decl: AddressOfParam = fn_decl @AddressOfParam [template = constants.%struct.8] {
|
||||
// CHECK:STDOUT: %param.loc91_19.1: i32 = param param
|
||||
// CHECK:STDOUT: @AddressOfParam.%param: i32 = bind_name param, %param.loc91_19.1
|
||||
// CHECK:STDOUT: }
|
||||
@@ -157,19 +174,19 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AddressOfLiteral() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc16_4: i32 = int_literal 0 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc16_4: i32 = int_literal 0 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc16_3: i32* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc21_4: bool = bool_literal true [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc21_4: bool = bool_literal true [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc21_3: bool* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc26_4: f64 = float_literal 1 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc26_4: f64 = float_literal 1 [template = constants.%.7]
|
||||
// CHECK:STDOUT: %.loc26_3: f64* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc31_4: String = string_literal "Hello" [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc31_4: String = string_literal "Hello" [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc31_3: String* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc36_5: i32 = int_literal 1 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc36_8: i32 = int_literal 2 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc36_5: i32 = int_literal 1 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc36_8: i32 = int_literal 2 [template = constants.%.12]
|
||||
// CHECK:STDOUT: %.loc36_9: (i32, i32) = tuple_literal (%.loc36_5, %.loc36_8)
|
||||
// CHECK:STDOUT: %.loc36_3: (i32, i32)* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc41_10: i32 = int_literal 5 [template = constants.%.14]
|
||||
// CHECK:STDOUT: %.loc41_10: i32 = int_literal 5 [template = constants.%.15]
|
||||
// CHECK:STDOUT: %.loc41_11: {.a: i32} = struct_literal (%.loc41_10)
|
||||
// CHECK:STDOUT: %.loc41_3: {.a: i32}* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: return
|
||||
@@ -177,32 +194,32 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AddressOfOperator() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc49_5: bool = bool_literal true [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc49_10.1: bool = bool_literal false [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc49_5: bool = bool_literal true [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc49_10.1: bool = bool_literal false [template = constants.%.17]
|
||||
// CHECK:STDOUT: if %.loc49_5 br !and.rhs else br !and.result(%.loc49_10.1)
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !and.rhs:
|
||||
// CHECK:STDOUT: %.loc49_14: bool = bool_literal false [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc49_14: bool = bool_literal false [template = constants.%.17]
|
||||
// CHECK:STDOUT: br !and.result(%.loc49_14)
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !and.result:
|
||||
// CHECK:STDOUT: %.loc49_10.2: bool = block_arg !and.result [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc49_10.2: bool = block_arg !and.result [template = constants.%.17]
|
||||
// CHECK:STDOUT: %.loc49_3: bool* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %H.ref: <function> = name_ref H, file.%H [template = file.%H]
|
||||
// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.2]
|
||||
// CHECK:STDOUT: %H.call: init {.a: i32} = call %H.ref()
|
||||
// CHECK:STDOUT: %.loc54_5.1: ref {.a: i32} = temporary_storage
|
||||
// CHECK:STDOUT: %.loc54_5.2: ref {.a: i32} = temporary %.loc54_5.1, %H.call
|
||||
// CHECK:STDOUT: %.loc54_7: ref i32 = struct_access %.loc54_5.2, element0
|
||||
// CHECK:STDOUT: %.loc54_3: i32* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc59_9: bool = bool_literal true [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc59_5: bool = not %.loc59_9 [template = constants.%.16]
|
||||
// CHECK:STDOUT: %.loc59_9: bool = bool_literal true [template = constants.%.5]
|
||||
// CHECK:STDOUT: %.loc59_5: bool = not %.loc59_9 [template = constants.%.17]
|
||||
// CHECK:STDOUT: %.loc59_3: bool* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AddressOfCall() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %G.ref: <function> = name_ref G, file.%G [template = file.%G]
|
||||
// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1]
|
||||
// CHECK:STDOUT: %G.call: init i32 = call %G.ref()
|
||||
// CHECK:STDOUT: %.loc67: i32* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: return
|
||||
@@ -211,28 +228,28 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT: fn @AddressOfType() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc75: type* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc80_5: type = const_type i32 [template = constants.%.18]
|
||||
// CHECK:STDOUT: %.loc80_14: type = ptr_type const i32 [template = constants.%.19]
|
||||
// CHECK:STDOUT: %.loc80_5: type = const_type i32 [template = constants.%.19]
|
||||
// CHECK:STDOUT: %.loc80_14: type = ptr_type const i32 [template = constants.%.20]
|
||||
// CHECK:STDOUT: %.loc80_3: type* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AddressOfTupleElementValue() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc88_6: i32 = int_literal 1 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc88_9: i32 = int_literal 2 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc88_6: i32 = int_literal 1 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc88_9: i32 = int_literal 2 [template = constants.%.12]
|
||||
// CHECK:STDOUT: %.loc88_10.1: (i32, i32) = tuple_literal (%.loc88_6, %.loc88_9)
|
||||
// CHECK:STDOUT: %.loc88_12: i32 = int_literal 0 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc88_12: i32 = int_literal 0 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.loc88_6, %.loc88_9) [template = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc88_10.2: (i32, i32) = converted %.loc88_10.1, %tuple [template = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc88_13: i32 = tuple_index %.loc88_10.2, %.loc88_12 [template = constants.%.10]
|
||||
// CHECK:STDOUT: %.loc88_13: i32 = tuple_index %.loc88_10.2, %.loc88_12 [template = constants.%.11]
|
||||
// CHECK:STDOUT: %.loc88_3: i32* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AddressOfParam(%param: i32) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc95_22: type = ptr_type i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc95_22: type = ptr_type i32 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %param_addr.var: ref i32* = var param_addr
|
||||
// CHECK:STDOUT: %param_addr: ref i32* = bind_name param_addr, %param_addr.var
|
||||
// CHECK:STDOUT: %param.ref: i32 = name_ref param, %param
|
||||
|
||||
+10
-4
@@ -18,20 +18,26 @@ fn A() {
|
||||
|
||||
// CHECK:STDOUT: --- fail_deref_function.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %A: type = fn_type @A [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct: A = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .A = %A
|
||||
// CHECK:STDOUT: .A = %A.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
|
||||
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @A() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %A.ref.loc12: <function> = name_ref A, file.%A [template = file.%A]
|
||||
// CHECK:STDOUT: %A.ref.loc12: A = name_ref A, file.%A.decl [template = constants.%struct]
|
||||
// CHECK:STDOUT: %.loc12: ref <error> = deref <error>
|
||||
// CHECK:STDOUT: %A.ref.loc16: <function> = name_ref A, file.%A [template = file.%A]
|
||||
// CHECK:STDOUT: %A.ref.loc16: A = name_ref A, file.%A.decl [template = constants.%struct]
|
||||
// CHECK:STDOUT: %.loc16: ref <error> = deref <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -20,15 +20,21 @@ fn F() {
|
||||
|
||||
// CHECK:STDOUT: --- fail_deref_namespace.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %F: type = fn_type @F [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct: F = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .A = %A
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %A: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
|
||||
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
|
||||
@@ -39,19 +39,21 @@ fn Deref(n: i32) {
|
||||
// CHECK:STDOUT: --- fail_deref_not_pointer.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Deref: type = fn_type @Deref [template]
|
||||
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct.1: Deref = struct_value () [template]
|
||||
// CHECK:STDOUT: %tuple: () = tuple_value () [template]
|
||||
// CHECK:STDOUT: %.2: type = struct_type {} [template]
|
||||
// CHECK:STDOUT: %struct: {} = struct_value () [template]
|
||||
// CHECK:STDOUT: %struct.2: {} = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .Deref = %Deref
|
||||
// CHECK:STDOUT: .Deref = %Deref.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %Deref: <function> = fn_decl @Deref [template] {
|
||||
// CHECK:STDOUT: %Deref.decl: Deref = fn_decl @Deref [template = constants.%struct.1] {
|
||||
// CHECK:STDOUT: %n.loc7_10.1: i32 = param n
|
||||
// CHECK:STDOUT: @Deref.%n: i32 = bind_name n, %n.loc7_10.1
|
||||
// CHECK:STDOUT: }
|
||||
@@ -72,12 +74,12 @@ fn Deref(n: i32) {
|
||||
// CHECK:STDOUT: %.loc27_4.2: () = converted %.loc27_4.1, %tuple.loc27 [template = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc27_5: ref <error> = deref %.loc27_4.2
|
||||
// CHECK:STDOUT: %.loc32_5.1: {} = struct_literal ()
|
||||
// CHECK:STDOUT: %struct.loc32: {} = struct_value () [template = constants.%struct]
|
||||
// CHECK:STDOUT: %.loc32_5.2: {} = converted %.loc32_5.1, %struct.loc32 [template = constants.%struct]
|
||||
// CHECK:STDOUT: %struct.loc32: {} = struct_value () [template = constants.%struct.2]
|
||||
// CHECK:STDOUT: %.loc32_5.2: {} = converted %.loc32_5.1, %struct.loc32 [template = constants.%struct.2]
|
||||
// CHECK:STDOUT: %.loc32_3: ref <error> = deref %.loc32_5.2
|
||||
// CHECK:STDOUT: %.loc36_4.1: {} = struct_literal ()
|
||||
// CHECK:STDOUT: %struct.loc36: {} = struct_value () [template = constants.%struct]
|
||||
// CHECK:STDOUT: %.loc36_4.2: {} = converted %.loc36_4.1, %struct.loc36 [template = constants.%struct]
|
||||
// CHECK:STDOUT: %struct.loc36: {} = struct_value () [template = constants.%struct.2]
|
||||
// CHECK:STDOUT: %.loc36_4.2: {} = converted %.loc36_4.1, %struct.loc36 [template = constants.%struct.2]
|
||||
// CHECK:STDOUT: %.loc36_5: ref <error> = deref %.loc36_4.2
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -19,15 +19,18 @@ fn ConstMismatch(p: const {}*) -> const ({}*) {
|
||||
// CHECK:STDOUT: %.3: type = ptr_type const {} [template]
|
||||
// CHECK:STDOUT: %.4: type = ptr_type {} [template]
|
||||
// CHECK:STDOUT: %.5: type = const_type {}* [template]
|
||||
// CHECK:STDOUT: %ConstMismatch: type = fn_type @ConstMismatch [template]
|
||||
// CHECK:STDOUT: %.6: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct: ConstMismatch = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .ConstMismatch = %ConstMismatch
|
||||
// CHECK:STDOUT: .ConstMismatch = %ConstMismatch.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %ConstMismatch: <function> = fn_decl @ConstMismatch [template] {
|
||||
// CHECK:STDOUT: %ConstMismatch.decl: ConstMismatch = fn_decl @ConstMismatch [template = constants.%struct] {
|
||||
// CHECK:STDOUT: %.loc7_28: {} = struct_literal ()
|
||||
// CHECK:STDOUT: %.loc7_21.1: type = converted %.loc7_28, constants.%.1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_21.2: type = const_type {} [template = constants.%.2]
|
||||
|
||||
+5
-2
@@ -17,15 +17,18 @@ fn F(p: const (const (const i32*)*)) -> const i32 {
|
||||
// CHECK:STDOUT: %.3: type = const_type const i32* [template]
|
||||
// CHECK:STDOUT: %.4: type = ptr_type const (const i32*) [template]
|
||||
// CHECK:STDOUT: %.5: type = const_type const (const i32*)* [template]
|
||||
// CHECK:STDOUT: %F: type = fn_type @F [template]
|
||||
// CHECK:STDOUT: %.6: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct: F = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
|
||||
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
|
||||
// CHECK:STDOUT: %.loc8_23: type = const_type i32 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc8_32: type = ptr_type const i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc8_16: type = const_type const i32* [template = constants.%.3]
|
||||
|
||||
+15
-10
@@ -16,31 +16,36 @@ fn ConstPtr(p: const i32*) -> (const i32)* {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %.2: type = const_type i32 [template]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type const i32 [template]
|
||||
// CHECK:STDOUT: %Ptr: type = fn_type @Ptr [template]
|
||||
// CHECK:STDOUT: %.2: type = tuple_type () [template]
|
||||
// CHECK:STDOUT: %struct.1: Ptr = struct_value () [template]
|
||||
// CHECK:STDOUT: %.3: type = const_type i32 [template]
|
||||
// CHECK:STDOUT: %.4: type = ptr_type const i32 [template]
|
||||
// CHECK:STDOUT: %ConstPtr: type = fn_type @ConstPtr [template]
|
||||
// CHECK:STDOUT: %struct.2: ConstPtr = struct_value () [template]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .Ptr = %Ptr
|
||||
// CHECK:STDOUT: .ConstPtr = %ConstPtr
|
||||
// CHECK:STDOUT: .Ptr = %Ptr.decl
|
||||
// CHECK:STDOUT: .ConstPtr = %ConstPtr.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %Ptr: <function> = fn_decl @Ptr [template] {
|
||||
// CHECK:STDOUT: %Ptr.decl: Ptr = fn_decl @Ptr [template = constants.%struct.1] {
|
||||
// CHECK:STDOUT: %.loc7_14: type = ptr_type i32 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %p.loc7_8.1: i32* = param p
|
||||
// CHECK:STDOUT: @Ptr.%p: i32* = bind_name p, %p.loc7_8.1
|
||||
// CHECK:STDOUT: %.loc7_23: type = ptr_type i32 [template = constants.%.1]
|
||||
// CHECK:STDOUT: @Ptr.%return: ref i32* = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ConstPtr: <function> = fn_decl @ConstPtr [template] {
|
||||
// CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc11_25: type = ptr_type const i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %ConstPtr.decl: ConstPtr = fn_decl @ConstPtr [template = constants.%struct.2] {
|
||||
// CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc11_25: type = ptr_type const i32 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %p.loc11_13.1: const i32* = param p
|
||||
// CHECK:STDOUT: @ConstPtr.%p: const i32* = bind_name p, %p.loc11_13.1
|
||||
// CHECK:STDOUT: %.loc11_32: type = const_type i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc11_32: type = const_type i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.4]
|
||||
// CHECK:STDOUT: @ConstPtr.%return: ref const i32* = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user