Files
carbon-lang/toolchain/check/testdata/let/generic_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

69 lines
2.3 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 T:! type = i32;
// --- implicit.impl.carbon
package Implicit impl;
var a: T*;
var b: T = *a;
// CHECK:STDOUT: --- implicit.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %T: type = bind_symbolic_name T 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: %T: type = bind_symbolic_name T 0, i32 [symbolic = constants.%T]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- implicit.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
// CHECK:STDOUT: %.1: type = ptr_type T [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .T = %import_ref
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref: type = import_ref ir0, inst+2, loaded [symbolic = constants.%T]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %T.ref.loc4: type = name_ref T, %import_ref [symbolic = constants.%T]
// CHECK:STDOUT: %.loc4: type = ptr_type T [symbolic = constants.%.1]
// CHECK:STDOUT: %a.var: ref T* = var a
// CHECK:STDOUT: %a: ref T* = bind_name a, %a.var
// CHECK:STDOUT: %T.ref.loc5: type = name_ref T, %import_ref [symbolic = constants.%T]
// CHECK:STDOUT: %b.var: ref T = var b
// CHECK:STDOUT: %b: ref T = bind_name b, %b.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.ref: ref T* = name_ref a, file.%a
// CHECK:STDOUT: %.loc5_13: T* = bind_value %a.ref
// CHECK:STDOUT: %.loc5_12.1: ref T = deref %.loc5_13
// CHECK:STDOUT: %.loc5_12.2: T = bind_value %.loc5_12.1
// CHECK:STDOUT: assign file.%b.var, %.loc5_12.2
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: