| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550 |
- // 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/class/no_prelude/indirect_import_member.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon
- // ============================================================================
- // Setup files
- // ============================================================================
- // --- a.carbon
- library "[[@TEST_NAME]]";
- class C {
- fn F() {}
- }
- // --- b.carbon
- library "[[@TEST_NAME]]";
- export import library "a";
- // --- c.carbon
- library "[[@TEST_NAME]]";
- import library "b";
- export C;
- // --- d.carbon
- library "[[@TEST_NAME]]";
- export import library "c";
- // --- e.carbon
- library "[[@TEST_NAME]]";
- import library "c";
- class D {
- alias C = package.C;
- }
- // --- f.carbon
- library "[[@TEST_NAME]]";
- export import library "e";
- // ============================================================================
- // Test files
- // ============================================================================
- // --- use_b.carbon
- library "[[@TEST_NAME]]";
- import library "b";
- var x: () = C.F();
- // --- use_c.carbon
- library "[[@TEST_NAME]]";
- import library "c";
- var x: () = C.F();
- // --- use_d.carbon
- library "[[@TEST_NAME]]";
- import library "d";
- var x: () = C.F();
- // --- use_e.carbon
- library "[[@TEST_NAME]]";
- import library "e";
- var x: () = D.C.F();
- // --- use_f.carbon
- library "[[@TEST_NAME]]";
- import library "f";
- var x: () = D.C.F();
- // CHECK:STDOUT: --- a.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- b.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.C = import_ref Main//a, C, unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = imports.%Main.C
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- c.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.C: type = import_ref Main//a, C, loaded [template = constants.%C]
- // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//a, loc6_1, loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//a, inst14 [no loc], unloaded
- // CHECK:STDOUT: %Main.import_ref.2cf = import_ref Main//a, loc5_10, unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = %C
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: %C: type = export C, imports.%Main.C [template = constants.%C]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C [from "a.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
- // CHECK:STDOUT: .F = imports.%Main.import_ref.2cf
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- d.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.C = import_ref Main//c, C, unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = imports.%Main.C
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- e.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %D: type = class_type @D [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.C: type = import_ref Main//c, C, loaded [template = constants.%C]
- // CHECK:STDOUT: %Main.import_ref.8db: <witness> = import_ref Main//c, inst19 [indirect], loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//c, inst20 [indirect], unloaded
- // CHECK:STDOUT: %Main.import_ref.230 = import_ref Main//c, inst21 [indirect], unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = imports.%Main.C
- // CHECK:STDOUT: .D = %D.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @D {
- // CHECK:STDOUT: %package.ref: <namespace> = name_ref package, package [template = package]
- // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
- // CHECK:STDOUT: %C: type = bind_alias C, imports.%Main.C [template = constants.%C]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%D
- // CHECK:STDOUT: .C = %C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C [from "c.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8db
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
- // CHECK:STDOUT: .F = imports.%Main.import_ref.230
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- f.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.D = import_ref Main//e, D, unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .D = imports.%Main.D
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_b.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.C: type = import_ref Main//a, C, loaded [template = constants.%C]
- // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//a, loc6_1, loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//a, inst14 [no loc], unloaded
- // CHECK:STDOUT: %Main.import_ref.943: %F.type = import_ref Main//a, loc5_10, loaded [template = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = imports.%Main.C
- // CHECK:STDOUT: .x = %x
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %x.patt: %empty_tuple.type = binding_pattern x
- // CHECK:STDOUT: %.loc6_1: %empty_tuple.type = var_pattern %x.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
- // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [template = constants.%empty_tuple.type] {
- // CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C [from "a.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
- // CHECK:STDOUT: .F = imports.%Main.import_ref.943
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() [from "a.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Main.import_ref.943 [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: assign file.%x.var, %F.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_c.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.C: type = import_ref Main//c, C, loaded [template = constants.%C]
- // CHECK:STDOUT: %Main.import_ref.8db: <witness> = import_ref Main//c, inst19 [indirect], loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//c, inst20 [indirect], unloaded
- // CHECK:STDOUT: %Main.import_ref.5d3: %F.type = import_ref Main//c, inst21 [indirect], loaded [template = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = imports.%Main.C
- // CHECK:STDOUT: .x = %x
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %x.patt: %empty_tuple.type = binding_pattern x
- // CHECK:STDOUT: %.loc6_1: %empty_tuple.type = var_pattern %x.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
- // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [template = constants.%empty_tuple.type] {
- // CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C [from "c.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8db
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
- // CHECK:STDOUT: .F = imports.%Main.import_ref.5d3
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() [from "a.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Main.import_ref.5d3 [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: assign file.%x.var, %F.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_d.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.C: type = import_ref Main//c, C, loaded [template = constants.%C]
- // CHECK:STDOUT: %Main.import_ref.8db: <witness> = import_ref Main//c, inst19 [indirect], loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//c, inst20 [indirect], unloaded
- // CHECK:STDOUT: %Main.import_ref.5d3: %F.type = import_ref Main//c, inst21 [indirect], loaded [template = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .C = imports.%Main.C
- // CHECK:STDOUT: .x = %x
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %x.patt: %empty_tuple.type = binding_pattern x
- // CHECK:STDOUT: %.loc6_1: %empty_tuple.type = var_pattern %x.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
- // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [template = constants.%empty_tuple.type] {
- // CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C [from "c.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8db
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
- // CHECK:STDOUT: .F = imports.%Main.import_ref.5d3
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() [from "a.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Main.import_ref.5d3 [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: assign file.%x.var, %F.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_e.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %D: type = class_type @D [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.D: type = import_ref Main//e, D, loaded [template = constants.%D]
- // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//e, loc8_1, loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.cab = import_ref Main//e, inst16 [no loc], unloaded
- // CHECK:STDOUT: %Main.import_ref.bf1: type = import_ref Main//e, loc7_9, loaded [template = constants.%C]
- // CHECK:STDOUT: %Main.import_ref.8f3: <witness> = import_ref Main//e, inst22 [indirect], loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.db8 = import_ref Main//e, inst23 [indirect], unloaded
- // CHECK:STDOUT: %Main.import_ref.c85: %F.type = import_ref Main//e, inst24 [indirect], loaded [template = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .D = imports.%Main.D
- // CHECK:STDOUT: .x = %x
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %x.patt: %empty_tuple.type = binding_pattern x
- // CHECK:STDOUT: %.loc6_1: %empty_tuple.type = var_pattern %x.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
- // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [template = constants.%empty_tuple.type] {
- // CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @D [from "e.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.cab
- // CHECK:STDOUT: .C = imports.%Main.import_ref.bf1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C [from "e.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f3
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.db8
- // CHECK:STDOUT: .F = imports.%Main.import_ref.c85
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() [from "a.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [template = constants.%D]
- // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.import_ref.bf1 [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Main.import_ref.c85 [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: assign file.%x.var, %F.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_f.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %D: type = class_type @D [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.D: type = import_ref Main//e, D, loaded [template = constants.%D]
- // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//e, loc8_1, loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.cab = import_ref Main//e, inst16 [no loc], unloaded
- // CHECK:STDOUT: %Main.import_ref.bf1: type = import_ref Main//e, loc7_9, loaded [template = constants.%C]
- // CHECK:STDOUT: %Main.import_ref.8f3: <witness> = import_ref Main//e, inst22 [indirect], loaded [template = constants.%complete_type]
- // CHECK:STDOUT: %Main.import_ref.db8 = import_ref Main//e, inst23 [indirect], unloaded
- // CHECK:STDOUT: %Main.import_ref.c85: %F.type = import_ref Main//e, inst24 [indirect], loaded [template = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .D = imports.%Main.D
- // CHECK:STDOUT: .x = %x
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %x.patt: %empty_tuple.type = binding_pattern x
- // CHECK:STDOUT: %.loc6_1: %empty_tuple.type = var_pattern %x.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
- // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [template = constants.%empty_tuple.type] {
- // CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @D [from "e.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.cab
- // CHECK:STDOUT: .C = imports.%Main.import_ref.bf1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C [from "e.carbon"] {
- // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f3
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%Main.import_ref.db8
- // CHECK:STDOUT: .F = imports.%Main.import_ref.c85
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() [from "a.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [template = constants.%D]
- // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.import_ref.bf1 [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Main.import_ref.c85 [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: assign file.%x.var, %F.call
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|