| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243 |
- // 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/function/declaration/import.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/import.carbon
- // ============================================================================
- // Setup files
- // ============================================================================
- // --- api.carbon
- library "[[@TEST_NAME]]";
- fn A();
- fn B(b: i32) -> i32;
- fn C(c: (i32,)) -> {.c: i32};
- extern fn D();
- namespace NS;
- fn NS.E();
- // --- extern_api.carbon
- library "[[@TEST_NAME]]";
- extern library "redecl_extern_api" fn A();
- extern library "redecl_extern_api" fn B(b: i32) -> i32;
- extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32};
- extern library "redecl_extern_api" fn D();
- namespace NS;
- extern library "redecl_extern_api" fn NS.E();
- // ============================================================================
- // Test files
- // ============================================================================
- // --- basics.carbon
- library "[[@TEST_NAME]]";
- import library "api";
- var a: () = A();
- var b: i32 = B(1);
- var c: {.c: i32} = C((1,));
- var d: () = D();
- var e: () = NS.E();
- // --- fail_redecl_api.carbon
- library "[[@TEST_NAME]]";
- import library "api";
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch]
- // CHECK:STDERR: extern fn A();
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-5]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:4:1: note: previously declared here [RedeclPrevDecl]
- // CHECK:STDERR: fn A();
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR:
- extern fn A();
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn B` must match use of `extern` [RedeclExternMismatch]
- // CHECK:STDERR: extern fn B(b: i32) -> i32;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-14]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:5:1: note: previously declared here [RedeclPrevDecl]
- // CHECK:STDERR: fn B(b: i32) -> i32;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- extern fn B(b: i32) -> i32;
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn C` must match use of `extern` [RedeclExternMismatch]
- // CHECK:STDERR: extern fn C(c: (i32,)) -> {.c: i32};
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-23]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:6:1: note: previously declared here [RedeclPrevDecl]
- // CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32};
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- extern fn C(c: (i32,)) -> {.c: i32};
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclaration of `fn D` is redundant [RedeclRedundant]
- // CHECK:STDERR: extern fn D();
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-32]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:7:1: note: previously declared here [RedeclPrevDecl]
- // CHECK:STDERR: extern fn D();
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR:
- extern fn D();
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn E` must match use of `extern` [RedeclExternMismatch]
- // CHECK:STDERR: extern fn NS.E();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-41]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:10:1: note: previously declared here [RedeclPrevDecl]
- // CHECK:STDERR: fn NS.E();
- // CHECK:STDERR: ^~~~~~~~~~
- // CHECK:STDERR:
- extern fn NS.E();
- var a: () = A();
- var b: i32 = B(1);
- var c: {.c: i32} = C((1,));
- var d: () = D();
- var e: () = NS.E();
- // --- redecl_extern_api.carbon
- library "[[@TEST_NAME]]";
- import library "extern_api";
- extern fn A();
- extern fn B(b: i32) -> i32;
- extern fn C(c: (i32,)) -> {.c: i32};
- extern fn D();
- extern fn NS.E();
- var a: () = A();
- var b: i32 = B(1);
- var c: {.c: i32} = C((1,));
- var d: () = D();
- var e: () = NS.E();
- // --- fail_merge.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+45]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: extern library "redecl_extern_api" fn A();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+41]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: fn A();
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+36]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:5:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: extern library "redecl_extern_api" fn B(b: i32) -> i32;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+32]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:5:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: fn B(b: i32) -> i32;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+27]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:6:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32};
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+23]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:6:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32};
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+18]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:7:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: extern library "redecl_extern_api" fn D();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+14]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:7:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: extern fn D();
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+9]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:10:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: extern library "redecl_extern_api" fn NS.E();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge.carbon:[[@LINE+5]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:10:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: fn NS.E();
- // CHECK:STDERR: ^~~~~~~~~~
- // CHECK:STDERR:
- import library "api";
- import library "extern_api";
- var a: () = A();
- var b: i32 = B(1);
- var c: {.c: i32} = C((1,));
- var d: () = D();
- var e: () = NS.E();
- // --- fail_merge_reverse.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+44]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: fn A();
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+40]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: extern library "redecl_extern_api" fn A();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+35]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:5:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: fn B(b: i32) -> i32;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+31]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:5:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: extern library "redecl_extern_api" fn B(b: i32) -> i32;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+26]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:6:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32};
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+22]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:6:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32};
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+17]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:7:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: extern fn D();
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+13]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:7:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: extern library "redecl_extern_api" fn D();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+8]]:1: in import [InImport]
- // CHECK:STDERR: api.carbon:10:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: fn NS.E();
- // CHECK:STDERR: ^~~~~~~~~~
- // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+4]]:1: in import [InImport]
- // CHECK:STDERR: extern_api.carbon:10:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: extern library "redecl_extern_api" fn NS.E();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- import library "extern_api";
- import library "api";
- var a: () = A();
- var b: i32 = B(1);
- var c: {.c: i32} = C((1,));
- var d: () = D();
- var e: () = NS.E();
- // --- unloaded.carbon
- library "[[@TEST_NAME]]";
- import library "api";
- // --- unloaded_extern.carbon
- library "[[@TEST_NAME]]";
- import library "extern_api";
- // CHECK:STDOUT: --- api.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A.type: type = fn_type @A [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %A: %A.type = struct_value () [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %B.type: type = fn_type @B [template]
- // CHECK:STDOUT: %B: %B.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
- // CHECK:STDOUT: %C.type: type = fn_type @C [template]
- // CHECK:STDOUT: %C: %C.type = struct_value () [template]
- // CHECK:STDOUT: %D.type: type = fn_type @D [template]
- // CHECK:STDOUT: %D: %D.type = struct_value () [template]
- // CHECK:STDOUT: %E.type: type = fn_type @E [template]
- // CHECK:STDOUT: %E: %E.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: .D = %D.decl
- // CHECK:STDOUT: .NS = %NS
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
- // CHECK:STDOUT: %b.patt: i32 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: i32 = value_param_pattern %b.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int.make_type_32.loc5_9: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_9.1: type = value_of_initializer %int.make_type_32.loc5_9 [template = i32]
- // CHECK:STDOUT: %.loc5_9.2: type = converted %int.make_type_32.loc5_9, %.loc5_9.1 [template = i32]
- // CHECK:STDOUT: %int.make_type_32.loc5_17: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_17.1: type = value_of_initializer %int.make_type_32.loc5_17 [template = i32]
- // CHECK:STDOUT: %.loc5_17.2: type = converted %int.make_type_32.loc5_17, %.loc5_17.1 [template = i32]
- // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
- // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
- // CHECK:STDOUT: %c.patt: %.3 = binding_pattern c
- // CHECK:STDOUT: %c.param_patt: %.3 = value_param_pattern %c.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int.make_type_32.loc6_10: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_14.1: %.2 = tuple_literal (%int.make_type_32.loc6_10)
- // CHECK:STDOUT: %.loc6_14.2: type = value_of_initializer %int.make_type_32.loc6_10 [template = i32]
- // CHECK:STDOUT: %.loc6_14.3: type = converted %int.make_type_32.loc6_10, %.loc6_14.2 [template = i32]
- // CHECK:STDOUT: %.loc6_14.4: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %int.make_type_32.loc6_25: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_25.1: type = value_of_initializer %int.make_type_32.loc6_25 [template = i32]
- // CHECK:STDOUT: %.loc6_25.2: type = converted %int.make_type_32.loc6_25, %.loc6_25.1 [template = i32]
- // CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.4]
- // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
- // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
- // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
- // CHECK:STDOUT: %NS: <namespace> = namespace [template] {
- // CHECK:STDOUT: .E = %E.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @C(%c.param_patt: %.3) -> %.4;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @D();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @E();
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- extern_api.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A.type: type = fn_type @A [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %A: %A.type = struct_value () [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %B.type: type = fn_type @B [template]
- // CHECK:STDOUT: %B: %B.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
- // CHECK:STDOUT: %C.type: type = fn_type @C [template]
- // CHECK:STDOUT: %C: %C.type = struct_value () [template]
- // CHECK:STDOUT: %D.type: type = fn_type @D [template]
- // CHECK:STDOUT: %D: %D.type = struct_value () [template]
- // CHECK:STDOUT: %E.type: type = fn_type @E [template]
- // CHECK:STDOUT: %E: %E.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: .D = %D.decl
- // CHECK:STDOUT: .NS = %NS
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
- // CHECK:STDOUT: %b.patt: i32 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: i32 = value_param_pattern %b.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int.make_type_32.loc5_44: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_44.1: type = value_of_initializer %int.make_type_32.loc5_44 [template = i32]
- // CHECK:STDOUT: %.loc5_44.2: type = converted %int.make_type_32.loc5_44, %.loc5_44.1 [template = i32]
- // CHECK:STDOUT: %int.make_type_32.loc5_52: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_52.1: type = value_of_initializer %int.make_type_32.loc5_52 [template = i32]
- // CHECK:STDOUT: %.loc5_52.2: type = converted %int.make_type_32.loc5_52, %.loc5_52.1 [template = i32]
- // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
- // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
- // CHECK:STDOUT: %c.patt: %.3 = binding_pattern c
- // CHECK:STDOUT: %c.param_patt: %.3 = value_param_pattern %c.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int.make_type_32.loc6_45: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_49.1: %.2 = tuple_literal (%int.make_type_32.loc6_45)
- // CHECK:STDOUT: %.loc6_49.2: type = value_of_initializer %int.make_type_32.loc6_45 [template = i32]
- // CHECK:STDOUT: %.loc6_49.3: type = converted %int.make_type_32.loc6_45, %.loc6_49.2 [template = i32]
- // CHECK:STDOUT: %.loc6_49.4: type = converted %.loc6_49.1, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %int.make_type_32.loc6_60: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_60.1: type = value_of_initializer %int.make_type_32.loc6_60 [template = i32]
- // CHECK:STDOUT: %.loc6_60.2: type = converted %int.make_type_32.loc6_60, %.loc6_60.1 [template = i32]
- // CHECK:STDOUT: %.loc6_63: type = struct_type {.c: i32} [template = constants.%.4]
- // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
- // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
- // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
- // CHECK:STDOUT: %NS: <namespace> = namespace [template] {
- // CHECK:STDOUT: .E = %E.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @A();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @B(%b.param_patt: i32) -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @C(%c.param_patt: %.3) -> %.4;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @D();
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @E();
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- basics.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %A.type: type = fn_type @A [template]
- // CHECK:STDOUT: %A: %A.type = struct_value () [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %B.type: type = fn_type @B [template]
- // CHECK:STDOUT: %B: %B.type = struct_value () [template]
- // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
- // CHECK:STDOUT: %C.type: type = fn_type @C [template]
- // CHECK:STDOUT: %C: %C.type = struct_value () [template]
- // CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.2) [template]
- // CHECK:STDOUT: %D.type: type = fn_type @D [template]
- // CHECK:STDOUT: %D: %D.type = struct_value () [template]
- // CHECK:STDOUT: %E.type: type = fn_type @E [template]
- // CHECK:STDOUT: %E: %E.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
- // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+28, loaded [template = constants.%B]
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+53, loaded [template = constants.%C]
- // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+56, loaded [template = constants.%D]
- // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
- // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
- // CHECK:STDOUT: .E = %import_ref.6
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+60, loaded [template = constants.%E]
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.7
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .A = imports.%import_ref.1
- // CHECK:STDOUT: .B = imports.%import_ref.2
- // CHECK:STDOUT: .C = imports.%import_ref.3
- // CHECK:STDOUT: .D = imports.%import_ref.4
- // CHECK:STDOUT: .NS = imports.%NS
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .a = %a
- // CHECK:STDOUT: .b = %b
- // CHECK:STDOUT: .c = %c
- // CHECK:STDOUT: .d = %d
- // CHECK:STDOUT: .e = %e
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %.loc6_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %a.var: ref %.1 = var a
- // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
- // CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
- // CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32]
- // CHECK:STDOUT: %b.var: ref i32 = var b
- // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
- // CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32]
- // CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32]
- // CHECK:STDOUT: %.loc8_16: type = struct_type {.c: i32} [template = constants.%.3]
- // CHECK:STDOUT: %c.var: ref %.3 = var c
- // CHECK:STDOUT: %c: ref %.3 = bind_name c, %c.var
- // CHECK:STDOUT: %.loc9_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc9_9.2: type = converted %.loc9_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %d.var: ref %.1 = var d
- // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
- // CHECK:STDOUT: %.loc10_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %e.var: ref %.1 = var e
- // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @C(%c.param_patt: %.4) -> %.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @D();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @E();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%import_ref.1 [template = constants.%A]
- // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
- // CHECK:STDOUT: assign file.%a.var, %A.call
- // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
- // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2]
- // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7)
- // CHECK:STDOUT: assign file.%b.var, %B.call
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
- // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2]
- // CHECK:STDOUT: %.loc8_25.1: %.4 = tuple_literal (%.loc8_23)
- // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.loc8_23) [template = constants.%tuple]
- // CHECK:STDOUT: %.loc8_25.2: %.4 = converted %.loc8_25.1, %tuple [template = constants.%tuple]
- // CHECK:STDOUT: %C.call: init %.3 = call %C.ref(%.loc8_25.2)
- // CHECK:STDOUT: assign file.%c.var, %C.call
- // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
- // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
- // CHECK:STDOUT: assign file.%d.var, %D.call
- // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
- // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%import_ref.6 [template = constants.%E]
- // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
- // CHECK:STDOUT: assign file.%e.var, %E.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_redecl_api.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A.type: type = fn_type @A [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %A: %A.type = struct_value () [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %B.type: type = fn_type @B [template]
- // CHECK:STDOUT: %B: %B.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
- // CHECK:STDOUT: %C.type: type = fn_type @C [template]
- // CHECK:STDOUT: %C: %C.type = struct_value () [template]
- // CHECK:STDOUT: %D.type: type = fn_type @D [template]
- // CHECK:STDOUT: %D: %D.type = struct_value () [template]
- // CHECK:STDOUT: %E.type: type = fn_type @E [template]
- // CHECK:STDOUT: %E: %E.type = struct_value () [template]
- // CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.5) [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
- // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+28, loaded [template = constants.%B]
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+53, loaded [template = constants.%C]
- // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+56, loaded [template = constants.%D]
- // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
- // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
- // CHECK:STDOUT: .E = file.%E.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+60, loaded [template = constants.%E]
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.7
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: .D = %D.decl
- // CHECK:STDOUT: .NS = imports.%NS
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .a = %a
- // CHECK:STDOUT: .b = %b
- // CHECK:STDOUT: .c = %c
- // CHECK:STDOUT: .d = %d
- // CHECK:STDOUT: .e = %e
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {} {
- // CHECK:STDOUT: %int.make_type_32.loc23_16: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc23_16.1: type = value_of_initializer %int.make_type_32.loc23_16 [template = i32]
- // CHECK:STDOUT: %.loc23_16.2: type = converted %int.make_type_32.loc23_16, %.loc23_16.1 [template = i32]
- // CHECK:STDOUT: %int.make_type_32.loc23_24: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc23_24.1: type = value_of_initializer %int.make_type_32.loc23_24 [template = i32]
- // CHECK:STDOUT: %.loc23_24.2: type = converted %int.make_type_32.loc23_24, %.loc23_24.1 [template = i32]
- // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
- // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
- // CHECK:STDOUT: %.loc23_21: ref i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {
- // CHECK:STDOUT: %int.make_type_32.loc32_17: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc32_21.1: %.2 = tuple_literal (%int.make_type_32.loc32_17)
- // CHECK:STDOUT: %.loc32_21.2: type = value_of_initializer %int.make_type_32.loc32_17 [template = i32]
- // CHECK:STDOUT: %.loc32_21.3: type = converted %int.make_type_32.loc32_17, %.loc32_21.2 [template = i32]
- // CHECK:STDOUT: %.loc32_21.4: type = converted %.loc32_21.1, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %int.make_type_32.loc32_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc32_32.1: type = value_of_initializer %int.make_type_32.loc32_32 [template = i32]
- // CHECK:STDOUT: %.loc32_32.2: type = converted %int.make_type_32.loc32_32, %.loc32_32.1 [template = i32]
- // CHECK:STDOUT: %.loc32_35: type = struct_type {.c: i32} [template = constants.%.4]
- // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
- // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
- // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
- // CHECK:STDOUT: %.loc32_24: ref %.4 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
- // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
- // CHECK:STDOUT: %.loc52_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc52_9.2: type = converted %.loc52_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %a.var: ref %.1 = var a
- // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
- // CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc53_8.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
- // CHECK:STDOUT: %.loc53_8.2: type = converted %int.make_type_32.loc53, %.loc53_8.1 [template = i32]
- // CHECK:STDOUT: %b.var: ref i32 = var b
- // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
- // CHECK:STDOUT: %int.make_type_32.loc54: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc54_13.1: type = value_of_initializer %int.make_type_32.loc54 [template = i32]
- // CHECK:STDOUT: %.loc54_13.2: type = converted %int.make_type_32.loc54, %.loc54_13.1 [template = i32]
- // CHECK:STDOUT: %.loc54_16: type = struct_type {.c: i32} [template = constants.%.4]
- // CHECK:STDOUT: %c.var: ref %.4 = var c
- // CHECK:STDOUT: %c: ref %.4 = bind_name c, %c.var
- // CHECK:STDOUT: %.loc55_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %d.var: ref %.1 = var d
- // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
- // CHECK:STDOUT: %.loc56_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc56_9.2: type = converted %.loc56_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %e.var: ref %.1 = var e
- // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @C(%c.param_patt: %.3) -> %.4;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @D();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @E();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
- // CHECK:STDOUT: assign file.%a.var, %A.call
- // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [template = constants.%B]
- // CHECK:STDOUT: %.loc53: i32 = int_literal 1 [template = constants.%.5]
- // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53)
- // CHECK:STDOUT: assign file.%b.var, %B.call
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %.loc54_23: i32 = int_literal 1 [template = constants.%.5]
- // CHECK:STDOUT: %.loc54_25.1: %.3 = tuple_literal (%.loc54_23)
- // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.loc54_23) [template = constants.%tuple]
- // CHECK:STDOUT: %.loc54_25.2: %.3 = converted %.loc54_25.1, %tuple [template = constants.%tuple]
- // CHECK:STDOUT: %C.call: init %.4 = call %C.ref(%.loc54_25.2)
- // CHECK:STDOUT: assign file.%c.var, %C.call
- // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [template = constants.%D]
- // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
- // CHECK:STDOUT: assign file.%d.var, %D.call
- // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
- // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [template = constants.%E]
- // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
- // CHECK:STDOUT: assign file.%e.var, %E.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- redecl_extern_api.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A.type: type = fn_type @A [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %A: %A.type = struct_value () [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %B.type: type = fn_type @B [template]
- // CHECK:STDOUT: %B: %B.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
- // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
- // CHECK:STDOUT: %C.type: type = fn_type @C [template]
- // CHECK:STDOUT: %C: %C.type = struct_value () [template]
- // CHECK:STDOUT: %D.type: type = fn_type @D [template]
- // CHECK:STDOUT: %D: %D.type = struct_value () [template]
- // CHECK:STDOUT: %E.type: type = fn_type @E [template]
- // CHECK:STDOUT: %E: %E.type = struct_value () [template]
- // CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.5) [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//extern_api, inst+3, loaded [template = constants.%A]
- // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+28, loaded [template = constants.%B]
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+53, loaded [template = constants.%C]
- // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+56, loaded [template = constants.%D]
- // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+59, loaded
- // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
- // CHECK:STDOUT: .E = file.%E.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+60, loaded [template = constants.%E]
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.7
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: .D = %D.decl
- // CHECK:STDOUT: .NS = imports.%NS
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .a = %a
- // CHECK:STDOUT: .b = %b
- // CHECK:STDOUT: .c = %c
- // CHECK:STDOUT: .d = %d
- // CHECK:STDOUT: .e = %e
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {} {
- // CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32]
- // CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7_16, %.loc7_16.1 [template = i32]
- // CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc7_24.1: type = value_of_initializer %int.make_type_32.loc7_24 [template = i32]
- // CHECK:STDOUT: %.loc7_24.2: type = converted %int.make_type_32.loc7_24, %.loc7_24.1 [template = i32]
- // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
- // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
- // CHECK:STDOUT: %.loc7_21: ref i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {
- // CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc8_21.1: %.2 = tuple_literal (%int.make_type_32.loc8_17)
- // CHECK:STDOUT: %.loc8_21.2: type = value_of_initializer %int.make_type_32.loc8_17 [template = i32]
- // CHECK:STDOUT: %.loc8_21.3: type = converted %int.make_type_32.loc8_17, %.loc8_21.2 [template = i32]
- // CHECK:STDOUT: %.loc8_21.4: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3]
- // CHECK:STDOUT: %int.make_type_32.loc8_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc8_32.1: type = value_of_initializer %int.make_type_32.loc8_32 [template = i32]
- // CHECK:STDOUT: %.loc8_32.2: type = converted %int.make_type_32.loc8_32, %.loc8_32.1 [template = i32]
- // CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.4]
- // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
- // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
- // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
- // CHECK:STDOUT: %.loc8_24: ref %.4 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
- // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
- // CHECK:STDOUT: %.loc12_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %a.var: ref %.1 = var a
- // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
- // CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
- // CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32]
- // CHECK:STDOUT: %b.var: ref i32 = var b
- // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
- // CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32]
- // CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32.loc14, %.loc14_13.1 [template = i32]
- // CHECK:STDOUT: %.loc14_16: type = struct_type {.c: i32} [template = constants.%.4]
- // CHECK:STDOUT: %c.var: ref %.4 = var c
- // CHECK:STDOUT: %c: ref %.4 = bind_name c, %c.var
- // CHECK:STDOUT: %.loc15_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %d.var: ref %.1 = var d
- // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
- // CHECK:STDOUT: %.loc16_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %e.var: ref %.1 = var e
- // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @A();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @B(%b.param_patt: i32) -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @C(%c.param_patt: %.3) -> %.4;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @D();
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @E();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
- // CHECK:STDOUT: assign file.%a.var, %A.call
- // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [template = constants.%B]
- // CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5]
- // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13)
- // CHECK:STDOUT: assign file.%b.var, %B.call
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5]
- // CHECK:STDOUT: %.loc14_25.1: %.3 = tuple_literal (%.loc14_23)
- // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.loc14_23) [template = constants.%tuple]
- // CHECK:STDOUT: %.loc14_25.2: %.3 = converted %.loc14_25.1, %tuple [template = constants.%tuple]
- // CHECK:STDOUT: %C.call: init %.4 = call %C.ref(%.loc14_25.2)
- // CHECK:STDOUT: assign file.%c.var, %C.call
- // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [template = constants.%D]
- // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
- // CHECK:STDOUT: assign file.%d.var, %D.call
- // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
- // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [template = constants.%E]
- // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
- // CHECK:STDOUT: assign file.%e.var, %E.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_merge.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %A.type: type = fn_type @A [template]
- // CHECK:STDOUT: %A: %A.type = struct_value () [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %B.type: type = fn_type @B [template]
- // CHECK:STDOUT: %B: %B.type = struct_value () [template]
- // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
- // CHECK:STDOUT: %C.type: type = fn_type @C [template]
- // CHECK:STDOUT: %C: %C.type = struct_value () [template]
- // CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.2) [template]
- // CHECK:STDOUT: %D.type: type = fn_type @D [template]
- // CHECK:STDOUT: %D: %D.type = struct_value () [template]
- // CHECK:STDOUT: %E.type: type = fn_type @E [template]
- // CHECK:STDOUT: %E: %E.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
- // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+28, loaded [template = constants.%B]
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+53, loaded [template = constants.%C]
- // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+56, loaded [template = constants.%D]
- // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
- // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
- // CHECK:STDOUT: .E = %import_ref.6
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+60, loaded [template = constants.%E]
- // CHECK:STDOUT: %import_ref.7 = import_ref Main//extern_api, inst+3, unloaded
- // CHECK:STDOUT: %import_ref.8 = import_ref Main//extern_api, inst+28, unloaded
- // CHECK:STDOUT: %import_ref.9 = import_ref Main//extern_api, inst+53, unloaded
- // CHECK:STDOUT: %import_ref.10 = import_ref Main//extern_api, inst+56, unloaded
- // CHECK:STDOUT: %import_ref.11 = import_ref Main//extern_api, inst+60, unloaded
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.12
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.12: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .A = imports.%import_ref.1
- // CHECK:STDOUT: .B = imports.%import_ref.2
- // CHECK:STDOUT: .C = imports.%import_ref.3
- // CHECK:STDOUT: .D = imports.%import_ref.4
- // CHECK:STDOUT: .NS = imports.%NS
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .a = %a
- // CHECK:STDOUT: .b = %b
- // CHECK:STDOUT: .c = %c
- // CHECK:STDOUT: .d = %d
- // CHECK:STDOUT: .e = %e
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %.loc52_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc52_9.2: type = converted %.loc52_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %a.var: ref %.1 = var a
- // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
- // CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc53_8.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
- // CHECK:STDOUT: %.loc53_8.2: type = converted %int.make_type_32.loc53, %.loc53_8.1 [template = i32]
- // CHECK:STDOUT: %b.var: ref i32 = var b
- // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
- // CHECK:STDOUT: %int.make_type_32.loc54: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc54_13.1: type = value_of_initializer %int.make_type_32.loc54 [template = i32]
- // CHECK:STDOUT: %.loc54_13.2: type = converted %int.make_type_32.loc54, %.loc54_13.1 [template = i32]
- // CHECK:STDOUT: %.loc54_16: type = struct_type {.c: i32} [template = constants.%.3]
- // CHECK:STDOUT: %c.var: ref %.3 = var c
- // CHECK:STDOUT: %c: ref %.3 = bind_name c, %c.var
- // CHECK:STDOUT: %.loc55_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %d.var: ref %.1 = var d
- // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
- // CHECK:STDOUT: %.loc56_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc56_9.2: type = converted %.loc56_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %e.var: ref %.1 = var e
- // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @C(%c.param_patt: %.4) -> %.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @D();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @E();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%import_ref.1 [template = constants.%A]
- // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
- // CHECK:STDOUT: assign file.%a.var, %A.call
- // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
- // CHECK:STDOUT: %.loc53: i32 = int_literal 1 [template = constants.%.2]
- // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53)
- // CHECK:STDOUT: assign file.%b.var, %B.call
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
- // CHECK:STDOUT: %.loc54_23: i32 = int_literal 1 [template = constants.%.2]
- // CHECK:STDOUT: %.loc54_25.1: %.4 = tuple_literal (%.loc54_23)
- // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.loc54_23) [template = constants.%tuple]
- // CHECK:STDOUT: %.loc54_25.2: %.4 = converted %.loc54_25.1, %tuple [template = constants.%tuple]
- // CHECK:STDOUT: %C.call: init %.3 = call %C.ref(%.loc54_25.2)
- // CHECK:STDOUT: assign file.%c.var, %C.call
- // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
- // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
- // CHECK:STDOUT: assign file.%d.var, %D.call
- // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
- // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%import_ref.6 [template = constants.%E]
- // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
- // CHECK:STDOUT: assign file.%e.var, %E.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_merge_reverse.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %A.type: type = fn_type @A [template]
- // CHECK:STDOUT: %A: %A.type = struct_value () [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %B.type: type = fn_type @B [template]
- // CHECK:STDOUT: %B: %B.type = struct_value () [template]
- // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
- // CHECK:STDOUT: %C.type: type = fn_type @C [template]
- // CHECK:STDOUT: %C: %C.type = struct_value () [template]
- // CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
- // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.2) [template]
- // CHECK:STDOUT: %D.type: type = fn_type @D [template]
- // CHECK:STDOUT: %D: %D.type = struct_value () [template]
- // CHECK:STDOUT: %E.type: type = fn_type @E [template]
- // CHECK:STDOUT: %E: %E.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//extern_api, inst+3, loaded [template = constants.%A]
- // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+28, loaded [template = constants.%B]
- // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+53, loaded [template = constants.%C]
- // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+56, loaded [template = constants.%D]
- // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+59, loaded
- // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
- // CHECK:STDOUT: .E = %import_ref.6
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+60, loaded [template = constants.%E]
- // CHECK:STDOUT: %import_ref.7 = import_ref Main//api, inst+3, unloaded
- // CHECK:STDOUT: %import_ref.8 = import_ref Main//api, inst+28, unloaded
- // CHECK:STDOUT: %import_ref.9 = import_ref Main//api, inst+53, unloaded
- // CHECK:STDOUT: %import_ref.10 = import_ref Main//api, inst+56, unloaded
- // CHECK:STDOUT: %import_ref.11 = import_ref Main//api, inst+60, unloaded
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.12
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.12: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .A = imports.%import_ref.1
- // CHECK:STDOUT: .B = imports.%import_ref.2
- // CHECK:STDOUT: .C = imports.%import_ref.3
- // CHECK:STDOUT: .D = imports.%import_ref.4
- // CHECK:STDOUT: .NS = imports.%NS
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .a = %a
- // CHECK:STDOUT: .b = %b
- // CHECK:STDOUT: .c = %c
- // CHECK:STDOUT: .d = %d
- // CHECK:STDOUT: .e = %e
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %.loc51_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc51_9.2: type = converted %.loc51_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %a.var: ref %.1 = var a
- // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
- // CHECK:STDOUT: %int.make_type_32.loc52: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc52_8.1: type = value_of_initializer %int.make_type_32.loc52 [template = i32]
- // CHECK:STDOUT: %.loc52_8.2: type = converted %int.make_type_32.loc52, %.loc52_8.1 [template = i32]
- // CHECK:STDOUT: %b.var: ref i32 = var b
- // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
- // CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc53_13.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
- // CHECK:STDOUT: %.loc53_13.2: type = converted %int.make_type_32.loc53, %.loc53_13.1 [template = i32]
- // CHECK:STDOUT: %.loc53_16: type = struct_type {.c: i32} [template = constants.%.3]
- // CHECK:STDOUT: %c.var: ref %.3 = var c
- // CHECK:STDOUT: %c: ref %.3 = bind_name c, %c.var
- // CHECK:STDOUT: %.loc54_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc54_9.2: type = converted %.loc54_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %d.var: ref %.1 = var d
- // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
- // CHECK:STDOUT: %.loc55_9.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %e.var: ref %.1 = var e
- // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @A();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @B(%b.param_patt: i32) -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @C(%c.param_patt: %.4) -> %.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @D();
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @E();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%import_ref.1 [template = constants.%A]
- // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
- // CHECK:STDOUT: assign file.%a.var, %A.call
- // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
- // CHECK:STDOUT: %.loc52: i32 = int_literal 1 [template = constants.%.2]
- // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc52)
- // CHECK:STDOUT: assign file.%b.var, %B.call
- // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
- // CHECK:STDOUT: %.loc53_23: i32 = int_literal 1 [template = constants.%.2]
- // CHECK:STDOUT: %.loc53_25.1: %.4 = tuple_literal (%.loc53_23)
- // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.loc53_23) [template = constants.%tuple]
- // CHECK:STDOUT: %.loc53_25.2: %.4 = converted %.loc53_25.1, %tuple [template = constants.%tuple]
- // CHECK:STDOUT: %C.call: init %.3 = call %C.ref(%.loc53_25.2)
- // CHECK:STDOUT: assign file.%c.var, %C.call
- // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
- // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
- // CHECK:STDOUT: assign file.%d.var, %D.call
- // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
- // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%import_ref.6 [template = constants.%E]
- // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
- // CHECK:STDOUT: assign file.%e.var, %E.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- unloaded.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1 = import_ref Main//api, inst+3, unloaded
- // CHECK:STDOUT: %import_ref.2 = import_ref Main//api, inst+28, unloaded
- // CHECK:STDOUT: %import_ref.3 = import_ref Main//api, inst+53, unloaded
- // CHECK:STDOUT: %import_ref.4 = import_ref Main//api, inst+56, unloaded
- // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
- // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
- // CHECK:STDOUT: .E = %import_ref.6
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.6 = import_ref Main//api, inst+60, unloaded
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .A = imports.%import_ref.1
- // CHECK:STDOUT: .B = imports.%import_ref.2
- // CHECK:STDOUT: .C = imports.%import_ref.3
- // CHECK:STDOUT: .D = imports.%import_ref.4
- // CHECK:STDOUT: .NS = imports.%NS
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- unloaded_extern.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1 = import_ref Main//extern_api, inst+3, unloaded
- // CHECK:STDOUT: %import_ref.2 = import_ref Main//extern_api, inst+28, unloaded
- // CHECK:STDOUT: %import_ref.3 = import_ref Main//extern_api, inst+53, unloaded
- // CHECK:STDOUT: %import_ref.4 = import_ref Main//extern_api, inst+56, unloaded
- // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+59, loaded
- // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
- // CHECK:STDOUT: .E = %import_ref.6
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.6 = import_ref Main//extern_api, inst+60, unloaded
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/index
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .A = imports.%import_ref.1
- // CHECK:STDOUT: .B = imports.%import_ref.2
- // CHECK:STDOUT: .C = imports.%import_ref.3
- // CHECK:STDOUT: .D = imports.%import_ref.4
- // CHECK:STDOUT: .NS = imports.%NS
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|