// 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/interface/no_prelude/fail_definition_imported.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/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]]:1: error: duplicate name 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> [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = 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: type = facet_type <@I> [template] // CHECK:STDOUT: %.type: type = facet_type <@.1> [template] // CHECK:STDOUT: %Self: %.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.I: type = import_ref Main//a, I, loaded [template = constants.%I.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .I = imports.%Main.I // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %.decl: type = interface_decl @.1 [template = constants.%.type] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I [from "a.carbon"]; // CHECK:STDOUT: // CHECK:STDOUT: interface @.1 { // CHECK:STDOUT: %Self: %.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: