Files
carbon-lang/toolchain/check/testdata/let/import.carbon
T
Jon Ross-Perkins 92fa0ac1ac Remove ImportRefUsed (#3934)
This was to track use of a declaration after import, prior to a
redeclaration. Per [discussion on
Discord](https://discord.com/channels/655572317891461132/1217182321933815820/1236016521059237962),
we likely don't need this check due to the change in behavior of
`extern`.

Rather than potentially getting one of many `extern` decls and depending
on it by accident, it is now planned to be _required_ to be imported,
and the library doing a non-`extern` decl must _know_ it's importing the
`extern` decl. The stricter requirement on the library means it now
seems more reasonable to use the `extern` decl.

So kind of rolling back #3831, though keeping `ImportIRInstId` (at least
for now) and keeping `Loaded`/`Unloaded` terminology (seems a nicer
fit).
2024-05-03 23:33:42 +00:00

53 lines
1.8 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;
let a:! bool = true;
// --- implicit.impl.carbon
package Implicit impl;
let b:! bool = a;
// CHECK:STDOUT: --- implicit.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: bool = bool_literal true [template]
// CHECK:STDOUT: %a: bool = bind_symbolic_name a 0 [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc4: bool = bool_literal true [template = constants.%.1]
// CHECK:STDOUT: %a: bool = bind_symbolic_name a 0, %.loc4 [symbolic = constants.%a]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- implicit.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %a: bool = bind_symbolic_name a 0 [symbolic]
// CHECK:STDOUT: %b: bool = bind_symbolic_name b 0 [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .a = %import_ref
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref: bool = import_ref ir0, inst+2, loaded [symbolic = constants.%a]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %a.ref: bool = name_ref a, %import_ref [symbolic = constants.%a]
// CHECK:STDOUT: %b: bool = bind_symbolic_name b 0, %a.ref [symbolic = constants.%b]
// CHECK:STDOUT: }
// CHECK:STDOUT: