Files
carbon-lang/toolchain/check/testdata/namespace/fail_import_of_repeat.carbon
T
Jon Ross-Perkins d0fb4b5815 Change DiagnoseDuplicateName to expect an inst ID for the duplicate. (#3616)
This makes duplicate and previous definition handling match. While we
may want to make both point more fine-grained at the name, the necessary
logic seems likely to be equivalent.

Note, I'm looking at this mainly due to duplicate names in imports,
where it's especially helpful to take an instruction instead of a parse
node. We'll eventually want to handle parse nodes from other imports
better, and I think this is the way it would most likely work.
2024-01-18 23:23:31 +00:00

39 lines
1.2 KiB
Plaintext

// 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
// --- implicit.carbon
package Implicit api;
namespace NS;
// CHECK:STDERR: implicit.carbon:[[@LINE+6]]:1: ERROR: Duplicate name being declared in the same scope.
// CHECK:STDERR: namespace NS;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: implicit.carbon:[[@LINE-4]]:1: Name is previously declared here.
// CHECK:STDERR: namespace NS;
// CHECK:STDERR: ^~~~~~~~~~~~~
namespace NS;
// --- implicit.impl.carbon
package Implicit impl;
// CHECK:STDOUT: --- implicit.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace package, {.NS = %.loc4} [template]
// CHECK:STDOUT: %.loc4: <namespace> = namespace NS, {} [template]
// CHECK:STDOUT: %.loc11: <namespace> = namespace <invalid>, {} [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- implicit.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace package, {.NS = %.2} [template]
// CHECK:STDOUT: %.2: <namespace> = namespace NS, {} [template]
// CHECK:STDOUT: }
// CHECK:STDOUT: