Files
carbon-lang/toolchain/check/testdata/let/import.carbon
T
Jon Ross-Perkins f76bc733f4 Add 'let' handling for ImportRefUsed. (#3700)
- File::StringifyTypeExpr now has a case that hits the ImportRefUsed
TODO, so implementing that. I think the `static` approach will be
helpful in ensuring there aren't access bugs, particularly when future
support is added.

- `let` wasn't adding to exports because it doesn't use
`decl_name_stack` the way `var` does. This now adds to exports, but we
might want to unify logic for issues such as this.

- BuildImportRefUsedValueRepr is now called for another inst kind, and
it seemed like calling back to BuildValueRepr was the best way to
resolve this. I don't *think* that's going to cause recursion.
2024-02-13 00:53:13 +00:00

40 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;
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: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace {} [template]
// CHECK:STDOUT: %.loc4: bool = bool_literal true [template = constants.%.1]
// CHECK:STDOUT: %a: bool = bind_symbolic_name a, %.loc4 [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- implicit.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace {.a = %import_ref} [template]
// CHECK:STDOUT: %import_ref: bool = import_ref ir1, inst+1, used [symbolic]
// CHECK:STDOUT: %a.ref: bool = name_ref a, %import_ref [symbolic = %import_ref]
// CHECK:STDOUT: %b: bool = bind_symbolic_name b, %a.ref [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT: