| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- // 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
- //
- // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
- // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
- // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/cross_package_import.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/cross_package_import.carbon
- // ============================================================================
- // Setup files
- // ============================================================================
- // --- other_fn.carbon
- package Other library "[[@TEST_NAME]]";
- fn F() {}
- // --- other_fn_extern.carbon
- package Other library "[[@TEST_NAME]]";
- extern fn F();
- // --- other_fn_conflict.carbon
- package Other library "[[@TEST_NAME]]";
- fn F(x: ()) {}
- // --- other_fn2.carbon
- package Other library "[[@TEST_NAME]]";
- fn F2() {}
- // --- other_fn_use.carbon
- package Other library "[[@TEST_NAME]]";
- import library "other_fn";
- fn G() { F(); }
- // --- main_other_ns.carbon
- library "[[@TEST_NAME]]";
- namespace Other;
- // ============================================================================
- // Test files
- // ============================================================================
- // --- main_use_other.carbon
- library "[[@TEST_NAME]]";
- import Other library "other_fn";
- import Other library "other_fn2";
- fn Run() {
- Other.F();
- Other.F2();
- }
- // --- fail_todo_main_use_other_extern.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+8]]:1: in import [InImport]
- // CHECK:STDERR: other_fn_extern.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: extern fn F();
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+4]]:1: in import [InImport]
- // CHECK:STDERR: other_fn.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: fn F() {}
- // CHECK:STDERR: ^~~~~~~~
- import Other library "other_fn";
- import Other library "other_fn_extern";
- fn Run() {
- // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+4]]:3: note: in name lookup for `F` [InNameLookup]
- // CHECK:STDERR: Other.F();
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR:
- Other.F();
- }
- // --- main_unused_other_ambiguous.carbon
- library "[[@TEST_NAME]]";
- import Other library "other_fn";
- import Other library "other_fn_conflict";
- // --- fail_main_use_other_ambiguous.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+8]]:1: in import [InImport]
- // CHECK:STDERR: other_fn_conflict.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: fn F(x: ()) {}
- // CHECK:STDERR: ^~~~~~~~~~~~~
- // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+4]]:1: in import [InImport]
- // CHECK:STDERR: other_fn.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: fn F() {}
- // CHECK:STDERR: ^~~~~~~~
- import Other library "other_fn";
- import Other library "other_fn_conflict";
- fn Run() {
- // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+4]]:3: note: in name lookup for `F` [InNameLookup]
- // CHECK:STDERR: Other.F();
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR:
- Other.F();
- }
- // --- fail_main_namespace_conflict.carbon
- library "[[@TEST_NAME]]";
- import library "main_other_ns";
- // CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+8]]:1: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: import Other library "other_fn";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE-4]]:1: in import [InImport]
- // CHECK:STDERR: main_other_ns.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: namespace Other;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- import Other library "other_fn";
- // CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+8]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant]
- // CHECK:STDERR: fn Other.F() {}
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE-5]]:1: in import [InImport]
- // CHECK:STDERR: other_fn.carbon:4:1: note: previously declared here [RedeclPrevDecl]
- // CHECK:STDERR: fn F() {}
- // CHECK:STDERR: ^~~~~~~~
- // CHECK:STDERR:
- fn Other.F() {}
- // --- fail_main_reopen_other.carbon
- library "[[@TEST_NAME]]";
- import Other library "other_fn";
- // CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE+7]]:11: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: namespace Other;
- // CHECK:STDERR: ^~~~~
- // CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: import Other library "other_fn";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- namespace Other;
- // This is not diagnosed after the diagnostic on `namespace Other;`.
- fn Other.G() {}
- // --- fail_main_reopen_other_nested.carbon
- library "[[@TEST_NAME]]";
- import Other library "other_fn";
- // CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE+7]]:11: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage]
- // CHECK:STDERR: namespace Other.Nested;
- // CHECK:STDERR: ^~~~~
- // CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE-5]]:1: note: package imported here [QualifiedDeclOutsidePackageSource]
- // CHECK:STDERR: import Other library "other_fn";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- namespace Other.Nested;
- // This is not diagnosed after the diagnostic on `namespace Other;`.
- fn Other.Nested.F() {}
- // --- fail_main_add_to_other.carbon
- library "[[@TEST_NAME]]";
- import Other library "other_fn";
- // CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE+7]]:4: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage]
- // CHECK:STDERR: fn Other.G() {}
- // CHECK:STDERR: ^~~~~
- // CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE-5]]:1: note: package imported here [QualifiedDeclOutsidePackageSource]
- // CHECK:STDERR: import Other library "other_fn";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn Other.G() {}
- // --- fail_use_other_fn_use.carbon
- library "[[@TEST_NAME]]";
- import Other library "other_fn_use";
- // CHECK:STDERR: fail_use_other_fn_use.carbon:[[@LINE+4]]:13: error: member name `F` not found in `Other` [MemberNameNotFoundInInstScope]
- // CHECK:STDERR: fn UseF() { Other.F(); }
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR:
- fn UseF() { Other.F(); }
- // CHECK:STDOUT: --- other_fn.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- other_fn_extern.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: extern fn @F();
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- other_fn_conflict.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
- // CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
- // CHECK:STDOUT: %x.patt: %pattern_type = value_binding_pattern x [concrete]
- // CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern %x.patt, call_param0 [concrete]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0
- // CHECK:STDOUT: %.loc4_10.1: type = splice_block %.loc4_10.3 [concrete = constants.%empty_tuple.type] {
- // CHECK:STDOUT: %.loc4_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
- // CHECK:STDOUT: %.loc4_10.3: type = converted %.loc4_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x: %empty_tuple.type = value_binding x, %x.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F(%x.param: %empty_tuple.type) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- other_fn2.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F2.type: type = fn_type @F2 [concrete]
- // CHECK:STDOUT: %F2: %F2.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .F2 = %F2.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F2.decl: %F2.type = fn_decl @F2 [concrete = constants.%F2] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F2() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- other_fn_use.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other.F: %F.type = import_ref Other//other_fn, F, loaded [concrete = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .F = imports.%Other.F
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Other.F [concrete = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F [from "other_fn.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- main_other_ns.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = %Other
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other: <namespace> = namespace [concrete] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- main_use_other.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %F2.type: type = fn_type @F2 [concrete]
- // CHECK:STDOUT: %F2: %F2.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: .F = %Other.F
- // CHECK:STDOUT: .F2 = %Other.F2
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: import Other//other_fn2
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.F: %F.type = import_ref Other//other_fn, F, loaded [concrete = constants.%F]
- // CHECK:STDOUT: %Other.F2: %F2.type = import_ref Other//other_fn2, F2, loaded [concrete = constants.%F2]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: .Run = %Run.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Run() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Other.ref.loc8: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Other.F [concrete = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: %Other.ref.loc9: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
- // CHECK:STDOUT: %F2.ref: %F2.type = name_ref F2, imports.%Other.F2 [concrete = constants.%F2]
- // CHECK:STDOUT: %F2.call: init %empty_tuple.type = call %F2.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F [from "other_fn.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F2 [from "other_fn2.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_todo_main_use_other_extern.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: .F = %Other.F
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: import Other//other_fn_extern
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.F: %F.type = import_ref Other//other_fn, F, loaded [concrete = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: .Run = %Run.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Run() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Other.F [concrete = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F [from "other_fn.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- main_unused_other_ambiguous.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: import Other//other_fn_conflict
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_main_use_other_ambiguous.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete]
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: .F = %Other.F
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: import Other//other_fn_conflict
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.F: %F.type = import_ref Other//other_fn, F, loaded [concrete = constants.%F]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: .Run = %Run.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Run() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Other.F [concrete = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F [from "other_fn.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_main_namespace_conflict.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F.type.a71006.1: type = fn_type @F.1 [concrete]
- // CHECK:STDOUT: %F.680f0e.1: %F.type.a71006.1 = struct_value () [concrete]
- // CHECK:STDOUT: %F.type.a71006.2: type = fn_type @F.loc23 [concrete]
- // CHECK:STDOUT: %F.680f0e.2: %F.type.a71006.2 = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.Other: <namespace> = import_ref Main//main_other_ns, Other, loaded
- // CHECK:STDOUT: %Other: <namespace> = namespace %Main.Other, [concrete] {
- // CHECK:STDOUT: .F = %Other.F
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.F: %F.type.a71006.1 = import_ref Other//other_fn, F, loaded [concrete = constants.%F.680f0e.1]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %F.decl: %F.type.a71006.2 = fn_decl @F.loc23 [concrete = constants.%F.680f0e.2] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.1 [from "other_fn.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.loc23() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_main_reopen_other.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
- // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: .G = file.%G.decl
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %Other: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_main_reopen_other_nested.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: .Nested = file.%Nested
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %Nested: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_main_add_to_other.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
- // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: .G = file.%G.decl
- // CHECK:STDOUT: import Other//other_fn
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_use_other_fn_use.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %UseF.type: type = fn_type @UseF [concrete]
- // CHECK:STDOUT: %UseF: %UseF.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
- // CHECK:STDOUT: .F = <poisoned>
- // CHECK:STDOUT: import Other//other_fn_use
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Other = imports.%Other
- // CHECK:STDOUT: .UseF = %UseF.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Other.import = import Other
- // CHECK:STDOUT: %UseF.decl: %UseF.type = fn_decl @UseF [concrete = constants.%UseF] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @UseF() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
- // CHECK:STDOUT: %F.ref: <error> = name_ref F, <error> [concrete = <error>]
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|