| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/import.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/import.carbon
- // --- implicit.carbon
- package Implicit;
- var a_ref: (i32,) = (0,);
- var b_ref: (((i32,), i32), (i32, i32)) = (((0,), 1), (2, 3));
- class C(X:! (i32, i32)) {}
- fn F() -> C((1, 2));
- // --- implicit.impl.carbon
- impl package Implicit;
- var a: (i32,) = a_ref;
- var b: (((i32,), i32), (i32, i32)) = b_ref;
- var c: C((1, 2)) = F();
- // --- fail_bad_type.impl.carbon
- impl package Implicit;
- // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+10]]:14: ERROR: Cannot initialize tuple of 2 element(s) from tuple with 3 element(s).
- // CHECK:STDERR: var c_bad: C((1, 2, 3)) = F();
- // CHECK:STDERR: ^~~~~~~~~
- // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE-5]]:6: In import.
- // CHECK:STDERR: impl package Implicit;
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR: implicit.carbon:7:1: Initializing parameter 1 of function declared here.
- // CHECK:STDERR: class C(X:! (i32, i32)) {}
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- var c_bad: C((1, 2, 3)) = F();
- // --- fail_bad_value.impl.carbon
- impl package Implicit;
- // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `C` to `C`.
- // CHECK:STDERR: var c_bad: C((3, 4)) = F();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
- var c_bad: C((3, 4)) = F();
- // CHECK:STDOUT: --- implicit.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %.4: i32 = int_literal 0 [template]
- // CHECK:STDOUT: %tuple.1: %.3 = tuple_value (%.4) [template]
- // CHECK:STDOUT: %.5: type = tuple_type (%.2, type) [template]
- // CHECK:STDOUT: %.6: type = tuple_type (type, type) [template]
- // CHECK:STDOUT: %.7: type = tuple_type (%.5, %.6) [template]
- // CHECK:STDOUT: %.8: type = tuple_type (%.3, i32) [template]
- // CHECK:STDOUT: %.9: type = tuple_type (i32, i32) [template]
- // CHECK:STDOUT: %.10: type = tuple_type (%.8, %.9) [template]
- // CHECK:STDOUT: %.11: type = ptr_type %.9 [template]
- // CHECK:STDOUT: %.12: type = ptr_type %.8 [template]
- // CHECK:STDOUT: %.13: type = tuple_type (%.12, %.11) [template]
- // CHECK:STDOUT: %.14: type = ptr_type %.13 [template]
- // CHECK:STDOUT: %.15: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %.16: i32 = int_literal 2 [template]
- // CHECK:STDOUT: %.17: i32 = int_literal 3 [template]
- // CHECK:STDOUT: %tuple.2: %.8 = tuple_value (%tuple.1, %.15) [template]
- // CHECK:STDOUT: %tuple.3: %.9 = tuple_value (%.16, %.17) [template]
- // CHECK:STDOUT: %tuple.4: %.10 = tuple_value (%tuple.2, %tuple.3) [template]
- // CHECK:STDOUT: %X: %.9 = bind_symbolic_name X 0 [symbolic]
- // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
- // CHECK:STDOUT: %C.1: %C.type = struct_value () [template]
- // CHECK:STDOUT: %C.2: type = class_type @C, (%X) [symbolic]
- // CHECK:STDOUT: %.18: type = struct_type {} [template]
- // CHECK:STDOUT: %tuple.5: %.9 = tuple_value (%.15, %.16) [template]
- // CHECK:STDOUT: %C.3: type = class_type @C, (%tuple.5) [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = %Core
- // CHECK:STDOUT: .a_ref = %a_ref
- // CHECK:STDOUT: .b_ref = %b_ref
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
- // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc4_17.1: %.2 = tuple_literal (%int.make_type_32.loc4)
- // CHECK:STDOUT: %.loc4_17.2: type = value_of_initializer %int.make_type_32.loc4 [template = i32]
- // CHECK:STDOUT: %.loc4_17.3: type = converted %int.make_type_32.loc4, %.loc4_17.2 [template = i32]
- // CHECK:STDOUT: %.loc4_17.4: type = converted %.loc4_17.1, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %a_ref.var: ref %.3 = var a_ref
- // CHECK:STDOUT: %a_ref: ref %.3 = bind_name a_ref, %a_ref.var
- // CHECK:STDOUT: %import_ref.2: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_15: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_19: %.2 = tuple_literal (%int.make_type_32.loc5_15)
- // CHECK:STDOUT: %import_ref.3: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_22: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_25: %.5 = tuple_literal (%.loc5_19, %int.make_type_32.loc5_22)
- // CHECK:STDOUT: %import_ref.4: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_29: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %import_ref.5: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_34: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_37: %.6 = tuple_literal (%int.make_type_32.loc5_29, %int.make_type_32.loc5_34)
- // CHECK:STDOUT: %.loc5_38.1: %.7 = tuple_literal (%.loc5_25, %.loc5_37)
- // CHECK:STDOUT: %.loc5_38.2: type = value_of_initializer %int.make_type_32.loc5_15 [template = i32]
- // CHECK:STDOUT: %.loc5_38.3: type = converted %int.make_type_32.loc5_15, %.loc5_38.2 [template = i32]
- // CHECK:STDOUT: %.loc5_38.4: type = converted %.loc5_19, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %.loc5_38.5: type = value_of_initializer %int.make_type_32.loc5_22 [template = i32]
- // CHECK:STDOUT: %.loc5_38.6: type = converted %int.make_type_32.loc5_22, %.loc5_38.5 [template = i32]
- // CHECK:STDOUT: %.loc5_38.7: type = converted %.loc5_25, constants.%.8 [template = constants.%.8]
- // CHECK:STDOUT: %.loc5_38.8: type = value_of_initializer %int.make_type_32.loc5_29 [template = i32]
- // CHECK:STDOUT: %.loc5_38.9: type = converted %int.make_type_32.loc5_29, %.loc5_38.8 [template = i32]
- // CHECK:STDOUT: %.loc5_38.10: type = value_of_initializer %int.make_type_32.loc5_34 [template = i32]
- // CHECK:STDOUT: %.loc5_38.11: type = converted %int.make_type_32.loc5_34, %.loc5_38.10 [template = i32]
- // CHECK:STDOUT: %.loc5_38.12: type = converted %.loc5_37, constants.%.9 [template = constants.%.9]
- // CHECK:STDOUT: %.loc5_38.13: type = converted %.loc5_38.1, constants.%.10 [template = constants.%.10]
- // CHECK:STDOUT: %b_ref.var: ref %.10 = var b_ref
- // CHECK:STDOUT: %b_ref: ref %.10 = bind_name b_ref, %b_ref.var
- // CHECK:STDOUT: %import_ref.6: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.1] {
- // CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc7_22.1: %.6 = tuple_literal (%int.make_type_32.loc7_14, %int.make_type_32.loc7_19)
- // CHECK:STDOUT: %.loc7_22.2: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32]
- // CHECK:STDOUT: %.loc7_22.3: type = converted %int.make_type_32.loc7_14, %.loc7_22.2 [template = i32]
- // CHECK:STDOUT: %.loc7_22.4: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32]
- // CHECK:STDOUT: %.loc7_22.5: type = converted %int.make_type_32.loc7_19, %.loc7_22.4 [template = i32]
- // CHECK:STDOUT: %.loc7_22.6: type = converted %.loc7_22.1, constants.%.9 [template = constants.%.9]
- // CHECK:STDOUT: %X.loc7_9.1: %.9 = param X
- // CHECK:STDOUT: %X.loc7_9.2: %.9 = bind_symbolic_name X 0, %X.loc7_9.1 [symbolic = constants.%X]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [template = constants.%C.1]
- // CHECK:STDOUT: %.loc9_14: i32 = int_literal 1 [template = constants.%.15]
- // CHECK:STDOUT: %.loc9_17: i32 = int_literal 2 [template = constants.%.16]
- // CHECK:STDOUT: %.loc9_18: %.9 = tuple_literal (%.loc9_14, %.loc9_17)
- // CHECK:STDOUT: %tuple: %.9 = tuple_value (%.loc9_14, %.loc9_17) [template = constants.%tuple.5]
- // CHECK:STDOUT: %.loc9_12.1: %.9 = converted %.loc9_18, %tuple [template = constants.%tuple.5]
- // CHECK:STDOUT: %.loc9_12.2: init type = call %C.ref(%.loc9_12.1) [template = constants.%C.3]
- // CHECK:STDOUT: %.loc9_19.1: type = value_of_initializer %.loc9_12.2 [template = constants.%C.3]
- // CHECK:STDOUT: %.loc9_19.2: type = converted %.loc9_12.2, %.loc9_19.1 [template = constants.%C.3]
- // CHECK:STDOUT: @F.%return: ref %C.3 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C
- // CHECK:STDOUT: generic [file.%X.loc7_9.2: %.9] {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() -> %C.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %.loc4_22: i32 = int_literal 0 [template = constants.%.4]
- // CHECK:STDOUT: %.loc4_24.1: %.3 = tuple_literal (%.loc4_22)
- // CHECK:STDOUT: %.loc4_24.2: init %.3 = tuple_init (%.loc4_22) to file.%a_ref.var [template = constants.%tuple.1]
- // CHECK:STDOUT: %.loc4_25: init %.3 = converted %.loc4_24.1, %.loc4_24.2 [template = constants.%tuple.1]
- // CHECK:STDOUT: assign file.%a_ref.var, %.loc4_25
- // CHECK:STDOUT: %.loc5_45: i32 = int_literal 0 [template = constants.%.4]
- // CHECK:STDOUT: %.loc5_47.1: %.3 = tuple_literal (%.loc5_45)
- // CHECK:STDOUT: %.loc5_50: i32 = int_literal 1 [template = constants.%.15]
- // CHECK:STDOUT: %.loc5_51.1: %.8 = tuple_literal (%.loc5_47.1, %.loc5_50)
- // CHECK:STDOUT: %.loc5_55: i32 = int_literal 2 [template = constants.%.16]
- // CHECK:STDOUT: %.loc5_58: i32 = int_literal 3 [template = constants.%.17]
- // CHECK:STDOUT: %.loc5_59.1: %.9 = tuple_literal (%.loc5_55, %.loc5_58)
- // CHECK:STDOUT: %.loc5_60.1: %.10 = tuple_literal (%.loc5_51.1, %.loc5_59.1)
- // CHECK:STDOUT: %.loc5_60.2: ref %.8 = tuple_access file.%b_ref.var, element0
- // CHECK:STDOUT: %.loc5_51.2: ref %.3 = tuple_access %.loc5_60.2, element0
- // CHECK:STDOUT: %.loc5_47.2: init %.3 = tuple_init (%.loc5_45) to %.loc5_51.2 [template = constants.%tuple.1]
- // CHECK:STDOUT: %.loc5_51.3: init %.3 = converted %.loc5_47.1, %.loc5_47.2 [template = constants.%tuple.1]
- // CHECK:STDOUT: %.loc5_51.4: init %.3 = initialize_from %.loc5_51.3 to %.loc5_51.2 [template = constants.%tuple.1]
- // CHECK:STDOUT: %.loc5_51.5: ref i32 = tuple_access %.loc5_60.2, element1
- // CHECK:STDOUT: %.loc5_51.6: init i32 = initialize_from %.loc5_50 to %.loc5_51.5 [template = constants.%.15]
- // CHECK:STDOUT: %.loc5_51.7: init %.8 = tuple_init (%.loc5_51.4, %.loc5_51.6) to %.loc5_60.2 [template = constants.%tuple.2]
- // CHECK:STDOUT: %.loc5_60.3: init %.8 = converted %.loc5_51.1, %.loc5_51.7 [template = constants.%tuple.2]
- // CHECK:STDOUT: %.loc5_60.4: ref %.9 = tuple_access file.%b_ref.var, element1
- // CHECK:STDOUT: %.loc5_59.2: ref i32 = tuple_access %.loc5_60.4, element0
- // CHECK:STDOUT: %.loc5_59.3: init i32 = initialize_from %.loc5_55 to %.loc5_59.2 [template = constants.%.16]
- // CHECK:STDOUT: %.loc5_59.4: ref i32 = tuple_access %.loc5_60.4, element1
- // CHECK:STDOUT: %.loc5_59.5: init i32 = initialize_from %.loc5_58 to %.loc5_59.4 [template = constants.%.17]
- // CHECK:STDOUT: %.loc5_59.6: init %.9 = tuple_init (%.loc5_59.3, %.loc5_59.5) to %.loc5_60.4 [template = constants.%tuple.3]
- // CHECK:STDOUT: %.loc5_60.5: init %.9 = converted %.loc5_59.1, %.loc5_59.6 [template = constants.%tuple.3]
- // CHECK:STDOUT: %.loc5_60.6: init %.10 = tuple_init (%.loc5_60.3, %.loc5_60.5) to file.%b_ref.var [template = constants.%tuple.4]
- // CHECK:STDOUT: %.loc5_61: init %.10 = converted %.loc5_60.1, %.loc5_60.6 [template = constants.%tuple.4]
- // CHECK:STDOUT: assign file.%b_ref.var, %.loc5_61
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- implicit.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %.4: type = tuple_type (%.2, type) [template]
- // CHECK:STDOUT: %.5: type = tuple_type (type, type) [template]
- // CHECK:STDOUT: %.6: type = tuple_type (%.4, %.5) [template]
- // CHECK:STDOUT: %.7: type = tuple_type (%.3, i32) [template]
- // CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template]
- // CHECK:STDOUT: %.9: type = tuple_type (%.7, %.8) [template]
- // CHECK:STDOUT: %.10: type = ptr_type %.8 [template]
- // CHECK:STDOUT: %.11: type = ptr_type %.7 [template]
- // CHECK:STDOUT: %.12: type = tuple_type (%.11, %.10) [template]
- // CHECK:STDOUT: %.13: type = ptr_type %.12 [template]
- // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
- // CHECK:STDOUT: %C.1: %C.type = struct_value () [template]
- // CHECK:STDOUT: %.14: type = struct_type {} [template]
- // CHECK:STDOUT: %X: %.8 = bind_symbolic_name X 0, <unexpected instref inst+102> [symbolic]
- // CHECK:STDOUT: %C.2: type = class_type @C, (%X) [symbolic]
- // CHECK:STDOUT: %.15: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %.16: i32 = int_literal 2 [template]
- // CHECK:STDOUT: %tuple: %.8 = tuple_value (%.15, %.16) [template]
- // CHECK:STDOUT: %C.3: type = class_type @C, (%tuple) [template]
- // CHECK:STDOUT: %.17: type = ptr_type %.14 [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .a_ref = %import_ref.1
- // CHECK:STDOUT: .b_ref = %import_ref.2
- // CHECK:STDOUT: .C = %import_ref.3
- // CHECK:STDOUT: .F = %import_ref.4
- // CHECK:STDOUT: .Core = %Core
- // CHECK:STDOUT: .a = %a
- // CHECK:STDOUT: .b = %b
- // CHECK:STDOUT: .c = %c
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.1: ref %.3 = import_ref ir0, inst+16, loaded
- // CHECK:STDOUT: %import_ref.2: ref %.9 = import_ref ir0, inst+60, loaded
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref ir0, inst+108, loaded [template = constants.%C.1]
- // CHECK:STDOUT: %import_ref.4: %F.type = import_ref ir0, inst+125, loaded [template = constants.%F]
- // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
- // CHECK:STDOUT: %import_ref.5: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc4_13.1: %.2 = tuple_literal (%int.make_type_32.loc4)
- // CHECK:STDOUT: %.loc4_13.2: type = value_of_initializer %int.make_type_32.loc4 [template = i32]
- // CHECK:STDOUT: %.loc4_13.3: type = converted %int.make_type_32.loc4, %.loc4_13.2 [template = i32]
- // CHECK:STDOUT: %.loc4_13.4: type = converted %.loc4_13.1, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %a.var: ref %.3 = var a
- // CHECK:STDOUT: %a: ref %.3 = bind_name a, %a.var
- // CHECK:STDOUT: %import_ref.6: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_11: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_15: %.2 = tuple_literal (%int.make_type_32.loc5_11)
- // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_18: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_21: %.4 = tuple_literal (%.loc5_15, %int.make_type_32.loc5_18)
- // CHECK:STDOUT: %import_ref.8: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_25: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %import_ref.9: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %int.make_type_32.loc5_30: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_33: %.5 = tuple_literal (%int.make_type_32.loc5_25, %int.make_type_32.loc5_30)
- // CHECK:STDOUT: %.loc5_34.1: %.6 = tuple_literal (%.loc5_21, %.loc5_33)
- // CHECK:STDOUT: %.loc5_34.2: type = value_of_initializer %int.make_type_32.loc5_11 [template = i32]
- // CHECK:STDOUT: %.loc5_34.3: type = converted %int.make_type_32.loc5_11, %.loc5_34.2 [template = i32]
- // CHECK:STDOUT: %.loc5_34.4: type = converted %.loc5_15, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %.loc5_34.5: type = value_of_initializer %int.make_type_32.loc5_18 [template = i32]
- // CHECK:STDOUT: %.loc5_34.6: type = converted %int.make_type_32.loc5_18, %.loc5_34.5 [template = i32]
- // CHECK:STDOUT: %.loc5_34.7: type = converted %.loc5_21, constants.%.7 [template = constants.%.7]
- // CHECK:STDOUT: %.loc5_34.8: type = value_of_initializer %int.make_type_32.loc5_25 [template = i32]
- // CHECK:STDOUT: %.loc5_34.9: type = converted %int.make_type_32.loc5_25, %.loc5_34.8 [template = i32]
- // CHECK:STDOUT: %.loc5_34.10: type = value_of_initializer %int.make_type_32.loc5_30 [template = i32]
- // CHECK:STDOUT: %.loc5_34.11: type = converted %int.make_type_32.loc5_30, %.loc5_34.10 [template = i32]
- // CHECK:STDOUT: %.loc5_34.12: type = converted %.loc5_33, constants.%.8 [template = constants.%.8]
- // CHECK:STDOUT: %.loc5_34.13: type = converted %.loc5_34.1, constants.%.9 [template = constants.%.9]
- // CHECK:STDOUT: %b.var: ref %.9 = var b
- // CHECK:STDOUT: %b: ref %.9 = bind_name b, %b.var
- // CHECK:STDOUT: %import_ref.10 = import_ref ir0, inst+111, unloaded
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %import_ref.3 [template = constants.%C.1]
- // CHECK:STDOUT: %.loc6_11: i32 = int_literal 1 [template = constants.%.15]
- // CHECK:STDOUT: %.loc6_14: i32 = int_literal 2 [template = constants.%.16]
- // CHECK:STDOUT: %.loc6_15: %.8 = tuple_literal (%.loc6_11, %.loc6_14)
- // CHECK:STDOUT: %tuple: %.8 = tuple_value (%.loc6_11, %.loc6_14) [template = constants.%tuple]
- // CHECK:STDOUT: %.loc6_9.1: %.8 = converted %.loc6_15, %tuple [template = constants.%tuple]
- // CHECK:STDOUT: %.loc6_9.2: init type = call %C.ref(%.loc6_9.1) [template = constants.%C.3]
- // CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %.loc6_9.2 [template = constants.%C.3]
- // CHECK:STDOUT: %.loc6_16.2: type = converted %.loc6_9.2, %.loc6_16.1 [template = constants.%C.3]
- // CHECK:STDOUT: %c.var: ref %C.3 = var c
- // CHECK:STDOUT: %c: ref %C.3 = bind_name c, %c.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = file.%import_ref.10
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() -> %C.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %a_ref.ref: ref %.3 = name_ref a_ref, file.%import_ref.1
- // CHECK:STDOUT: %.loc4_17.1: ref i32 = tuple_access %a_ref.ref, element0
- // CHECK:STDOUT: %.loc4_17.2: i32 = bind_value %.loc4_17.1
- // CHECK:STDOUT: %.loc4_17.3: init %.3 = tuple_init (%.loc4_17.2) to file.%a.var
- // CHECK:STDOUT: %.loc4_22: init %.3 = converted %a_ref.ref, %.loc4_17.3
- // CHECK:STDOUT: assign file.%a.var, %.loc4_22
- // CHECK:STDOUT: %b_ref.ref: ref %.9 = name_ref b_ref, file.%import_ref.2
- // CHECK:STDOUT: %.loc5_38.1: ref %.7 = tuple_access %b_ref.ref, element0
- // CHECK:STDOUT: %.loc5_38.2: ref %.3 = tuple_access %.loc5_38.1, element0
- // CHECK:STDOUT: %.loc5_38.3: ref i32 = tuple_access %.loc5_38.2, element0
- // CHECK:STDOUT: %.loc5_38.4: i32 = bind_value %.loc5_38.3
- // CHECK:STDOUT: %.loc5_38.5: ref %.7 = tuple_access file.%b.var, element0
- // CHECK:STDOUT: %.loc5_38.6: ref %.3 = tuple_access %.loc5_38.5, element0
- // CHECK:STDOUT: %.loc5_38.7: init %.3 = tuple_init (%.loc5_38.4) to %.loc5_38.6
- // CHECK:STDOUT: %.loc5_38.8: init %.3 = converted %.loc5_38.2, %.loc5_38.7
- // CHECK:STDOUT: %.loc5_38.9: init %.3 = initialize_from %.loc5_38.8 to %.loc5_38.6
- // CHECK:STDOUT: %.loc5_38.10: ref i32 = tuple_access %.loc5_38.1, element1
- // CHECK:STDOUT: %.loc5_38.11: i32 = bind_value %.loc5_38.10
- // CHECK:STDOUT: %.loc5_38.12: ref i32 = tuple_access %.loc5_38.5, element1
- // CHECK:STDOUT: %.loc5_38.13: init i32 = initialize_from %.loc5_38.11 to %.loc5_38.12
- // CHECK:STDOUT: %.loc5_38.14: init %.7 = tuple_init (%.loc5_38.9, %.loc5_38.13) to %.loc5_38.5
- // CHECK:STDOUT: %.loc5_38.15: init %.7 = converted %.loc5_38.1, %.loc5_38.14
- // CHECK:STDOUT: %.loc5_38.16: ref %.8 = tuple_access %b_ref.ref, element1
- // CHECK:STDOUT: %.loc5_38.17: ref i32 = tuple_access %.loc5_38.16, element0
- // CHECK:STDOUT: %.loc5_38.18: i32 = bind_value %.loc5_38.17
- // CHECK:STDOUT: %.loc5_38.19: ref %.8 = tuple_access file.%b.var, element1
- // CHECK:STDOUT: %.loc5_38.20: ref i32 = tuple_access %.loc5_38.19, element0
- // CHECK:STDOUT: %.loc5_38.21: init i32 = initialize_from %.loc5_38.18 to %.loc5_38.20
- // CHECK:STDOUT: %.loc5_38.22: ref i32 = tuple_access %.loc5_38.16, element1
- // CHECK:STDOUT: %.loc5_38.23: i32 = bind_value %.loc5_38.22
- // CHECK:STDOUT: %.loc5_38.24: ref i32 = tuple_access %.loc5_38.19, element1
- // CHECK:STDOUT: %.loc5_38.25: init i32 = initialize_from %.loc5_38.23 to %.loc5_38.24
- // CHECK:STDOUT: %.loc5_38.26: init %.8 = tuple_init (%.loc5_38.21, %.loc5_38.25) to %.loc5_38.19
- // CHECK:STDOUT: %.loc5_38.27: init %.8 = converted %.loc5_38.16, %.loc5_38.26
- // CHECK:STDOUT: %.loc5_38.28: init %.9 = tuple_init (%.loc5_38.15, %.loc5_38.27) to file.%b.var
- // CHECK:STDOUT: %.loc5_43: init %.9 = converted %b_ref.ref, %.loc5_38.28
- // CHECK:STDOUT: assign file.%b.var, %.loc5_43
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%import_ref.4 [template = constants.%F]
- // CHECK:STDOUT: %.loc6: ref %C.3 = splice_block file.%c.var {}
- // CHECK:STDOUT: %F.call: init %C.3 = call %F.ref() to %.loc6
- // CHECK:STDOUT: assign file.%c.var, %F.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_bad_type.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %C.1: %C.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {} [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template]
- // CHECK:STDOUT: %X: %.3 = bind_symbolic_name X 0, <unexpected instref inst+14> [symbolic]
- // CHECK:STDOUT: %C.2: type = class_type @C, (%X) [symbolic]
- // CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %.5: i32 = int_literal 2 [template]
- // CHECK:STDOUT: %.6: i32 = int_literal 3 [template]
- // CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template]
- // CHECK:STDOUT: %.8: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.4, %.5) [template]
- // CHECK:STDOUT: %C.3: type = class_type @C, (%tuple) [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %.9: type = ptr_type %.2 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .a_ref = %import_ref.1
- // CHECK:STDOUT: .b_ref = %import_ref.2
- // CHECK:STDOUT: .C = %import_ref.3
- // CHECK:STDOUT: .F = %import_ref.4
- // CHECK:STDOUT: .Core = %Core
- // CHECK:STDOUT: .c_bad = %c_bad
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.1 = import_ref ir0, inst+16, unloaded
- // CHECK:STDOUT: %import_ref.2 = import_ref ir0, inst+60, unloaded
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref ir0, inst+108, loaded [template = constants.%C.1]
- // CHECK:STDOUT: %import_ref.4: %F.type = import_ref ir0, inst+125, loaded [template = constants.%F]
- // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
- // CHECK:STDOUT: %import_ref.5 = import_ref ir0, inst+111, unloaded
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %import_ref.3 [template = constants.%C.1]
- // CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 [template = constants.%.4]
- // CHECK:STDOUT: %.loc14_18: i32 = int_literal 2 [template = constants.%.5]
- // CHECK:STDOUT: %.loc14_21: i32 = int_literal 3 [template = constants.%.6]
- // CHECK:STDOUT: %.loc14_22: %.7 = tuple_literal (%.loc14_15, %.loc14_18, %.loc14_21)
- // CHECK:STDOUT: %.loc14_13: init type = call %C.ref(<invalid>) [template = <error>]
- // CHECK:STDOUT: %.loc14_23.1: type = value_of_initializer %.loc14_13 [template = <error>]
- // CHECK:STDOUT: %.loc14_23.2: type = converted %.loc14_13, %.loc14_23.1 [template = <error>]
- // CHECK:STDOUT: %c_bad.var: ref <error> = var c_bad
- // CHECK:STDOUT: %c_bad: ref <error> = bind_name c_bad, %c_bad.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = file.%import_ref.5
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() -> %C.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%import_ref.4 [template = constants.%F]
- // CHECK:STDOUT: %.loc14: ref %C.3 = temporary_storage
- // CHECK:STDOUT: %F.call: init %C.3 = call %F.ref() to %.loc14
- // CHECK:STDOUT: assign file.%c_bad.var, <error>
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_bad_value.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %C.1: %C.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {} [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template]
- // CHECK:STDOUT: %X: %.3 = bind_symbolic_name X 0, <unexpected instref inst+14> [symbolic]
- // CHECK:STDOUT: %C.2: type = class_type @C, (%X) [symbolic]
- // CHECK:STDOUT: %.4: i32 = int_literal 3 [template]
- // CHECK:STDOUT: %.5: i32 = int_literal 4 [template]
- // CHECK:STDOUT: %.6: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %tuple.1: %.3 = tuple_value (%.4, %.5) [template]
- // CHECK:STDOUT: %C.3: type = class_type @C, (%tuple.1) [template]
- // CHECK:STDOUT: %.7: type = ptr_type %.2 [template]
- // CHECK:STDOUT: %.8: i32 = int_literal 2 [template]
- // CHECK:STDOUT: %.9: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %tuple.2: %.3 = tuple_value (%.9, %.8) [template]
- // CHECK:STDOUT: %C.4: type = class_type @C, (%tuple.2) [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .a_ref = %import_ref.1
- // CHECK:STDOUT: .b_ref = %import_ref.2
- // CHECK:STDOUT: .C = %import_ref.3
- // CHECK:STDOUT: .F = %import_ref.4
- // CHECK:STDOUT: .Core = %Core
- // CHECK:STDOUT: .c_bad = %c_bad
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.1 = import_ref ir0, inst+16, unloaded
- // CHECK:STDOUT: %import_ref.2 = import_ref ir0, inst+60, unloaded
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref ir0, inst+108, loaded [template = constants.%C.1]
- // CHECK:STDOUT: %import_ref.4: %F.type = import_ref ir0, inst+125, loaded [template = constants.%F]
- // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
- // CHECK:STDOUT: %import_ref.5 = import_ref ir0, inst+111, unloaded
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %import_ref.3 [template = constants.%C.1]
- // CHECK:STDOUT: %.loc7_15: i32 = int_literal 3 [template = constants.%.4]
- // CHECK:STDOUT: %.loc7_18: i32 = int_literal 4 [template = constants.%.5]
- // CHECK:STDOUT: %.loc7_19: %.3 = tuple_literal (%.loc7_15, %.loc7_18)
- // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.loc7_15, %.loc7_18) [template = constants.%tuple.1]
- // CHECK:STDOUT: %.loc7_13.1: %.3 = converted %.loc7_19, %tuple [template = constants.%tuple.1]
- // CHECK:STDOUT: %.loc7_13.2: init type = call %C.ref(%.loc7_13.1) [template = constants.%C.3]
- // CHECK:STDOUT: %.loc7_20.1: type = value_of_initializer %.loc7_13.2 [template = constants.%C.3]
- // CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_13.2, %.loc7_20.1 [template = constants.%C.3]
- // CHECK:STDOUT: %c_bad.var: ref %C.3 = var c_bad
- // CHECK:STDOUT: %c_bad: ref %C.3 = bind_name c_bad, %c_bad.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = file.%import_ref.5
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() -> %C.4;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%import_ref.4 [template = constants.%F]
- // CHECK:STDOUT: %.loc7: ref %C.4 = temporary_storage
- // CHECK:STDOUT: %F.call: init %C.4 = call %F.ref() to %.loc7
- // CHECK:STDOUT: assign file.%c_bad.var, <error>
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|