mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-22 02:56:41 +00:00
- 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.
55 lines
1.8 KiB
Plaintext
55 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 T:! type = i32;
|
|
|
|
// --- implicit.impl.carbon
|
|
|
|
package Implicit impl;
|
|
|
|
var a: T*;
|
|
var b: T = *a;
|
|
|
|
// CHECK:STDOUT: --- implicit.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace {} [template]
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, i32 [symbolic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- implicit.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %.1: type = ptr_type T [symbolic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace {.T = %import_ref, .a = %a, .b = %b} [template]
|
|
// CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [symbolic]
|
|
// CHECK:STDOUT: %T.ref.loc4: type = name_ref T, %import_ref [symbolic = %import_ref]
|
|
// 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 = %import_ref]
|
|
// 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:
|