Files
carbon-lang/toolchain/check/testdata/namespace/function.carbon
T
Jon Ross-Perkins 295c8eb97f Change Namespace formatting to use the scope's name. (#3782)
This change only affects the generated IR, but I think it's cleaning up
an existing issue with namespace name printing.
2024-03-14 21:12:26 +00:00

58 lines
1.7 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
namespace Foo;
// Never called, just here to help catch bugs in name lookup.
fn Baz() {
}
fn Foo.Baz() {
}
fn Bar() {
Foo.Baz();
}
// CHECK:STDOUT: --- function.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Foo = %Foo
// CHECK:STDOUT: .Baz = %Baz.loc10
// CHECK:STDOUT: .Bar = %Bar
// CHECK:STDOUT: }
// CHECK:STDOUT: %Foo: <namespace> = namespace [template] {
// CHECK:STDOUT: .Baz = %Baz.loc13
// CHECK:STDOUT: }
// CHECK:STDOUT: %Baz.loc10: <function> = fn_decl @Baz.1 [template] {}
// CHECK:STDOUT: %Baz.loc13: <function> = fn_decl @Baz.2 [template] {}
// CHECK:STDOUT: %Bar: <function> = fn_decl @Bar [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Baz.1() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Baz.2() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Bar() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Foo.ref: <namespace> = name_ref Foo, file.%Foo [template = file.%Foo]
// CHECK:STDOUT: %Baz.ref: <function> = name_ref Baz, file.%Baz.loc13 [template = file.%Baz.loc13]
// CHECK:STDOUT: %.loc17: init () = call %Baz.ref()
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: