| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- // 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/interface/fail_definition_imported.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_definition_imported.carbon
- // --- a.carbon
- library "[[@TEST_NAME]]";
- interface I;
- // --- fail_b.carbon
- library "[[@TEST_NAME]]";
- import library "a";
- // CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:11: error: duplicate name `I` being declared in the same scope [NameDeclDuplicate]
- // CHECK:STDERR: interface I {}
- // CHECK:STDERR: ^
- // CHECK:STDERR: fail_b.carbon:[[@LINE-5]]:1: in import [InImport]
- // CHECK:STDERR: a.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
- // CHECK:STDERR: interface I;
- // CHECK:STDERR: ^~~~~~~~~~~~
- // CHECK:STDERR:
- interface I {}
- // CHECK:STDOUT: --- a.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_b.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type.733a85.1: type = facet_type <@I.1> [concrete]
- // CHECK:STDOUT: %I.type.733a85.2: type = facet_type <@I.loc13> [concrete]
- // CHECK:STDOUT: %Self: %I.type.733a85.2 = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.I: type = import_ref Main//a, I, loaded [concrete = constants.%I.type.733a85.1]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .I = imports.%Main.I
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <none>
- // CHECK:STDOUT: %I.decl: type = interface_decl @I.loc13 [concrete = constants.%I.type.733a85.2] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I.1 [from "a.carbon"];
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I.loc13 {
- // CHECK:STDOUT: %Self: %I.type.733a85.2 = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: witness = ()
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|