Files
carbon-lang/toolchain/check/testdata/basics/raw_identifier.carbon
T
Jon Ross-Perkins 30155dbb72 Add support for 'package' in expressions. (#3445)
This creates a namespace for `package` scope.

It looks like names of class_decls in namespaces lead to an unexpected
instref. This is already true, as best as I can tell. I'm not sure if
there's a preferred approach to address that, so I've left a TODO for
now.
2023-12-04 21:05:41 +00:00

50 lines
1.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
//
// ARGS: compile --phase=check --dump-sem-ir %s
//
// Check that the command-line flag to dump textual IR works.
//
// AUTOUPDATE
fn A(n: i32) -> i32 {
return r#n;
}
fn B(r#n: i32) -> i32 {
return n;
}
fn C(r#if: i32) -> i32 {
return r#if;
}
// CHECK:STDOUT: --- raw_identifier.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace {.A = %A, .B = %B, .C = %C}
// CHECK:STDOUT: %A: <function> = fn_decl @A
// CHECK:STDOUT: %B: <function> = fn_decl @B
// CHECK:STDOUT: %C: <function> = fn_decl @C
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A(%n: i32) -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %n.ref: i32 = name_ref n, %n
// CHECK:STDOUT: return %n.ref
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%n: i32) -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %n.ref: i32 = name_ref n, %n
// CHECK:STDOUT: return %n.ref
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C(%if: i32) -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %if.ref: i32 = name_ref r#if, %if
// CHECK:STDOUT: return %if.ref
// CHECK:STDOUT: }
// CHECK:STDOUT: