| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- // 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+7]]:1: error: duplicate name being declared in the same scope
- // CHECK:STDERR: interface I {}
- // CHECK:STDERR: ^~~~~~~~~~~~~
- // CHECK:STDERR: fail_b.carbon:[[@LINE-5]]:1: in import
- // CHECK:STDERR: a.carbon:4:1: note: name is previously declared here
- // CHECK:STDERR: interface I;
- // CHECK:STDERR: ^~~~~~~~~~~~
- interface I {}
- // CHECK:STDOUT: --- a.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %.1: type = interface_type @I [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_b.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %.1: type = interface_type @I [template]
- // CHECK:STDOUT: %.2: type = interface_type @.1 [template]
- // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 0 [symbolic]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref: type = import_ref Main//a, inst+1, loaded [template = constants.%.1]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .I = imports.%import_ref
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %.decl: type = interface_decl @.1 [template = constants.%.2] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I;
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @.1 {
- // CHECK:STDOUT: %Self: %.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:
|