mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:30:14 +01:00
This is a precondition for enabling the new pattern-matching subsystem to support binding patterns that have `if` expressions in the type position. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
57 lines
2.8 KiB
Plaintext
57 lines
2.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
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/local.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/local.carbon
|
|
|
|
fn F() -> () {
|
|
var a: () = ();
|
|
alias b = a;
|
|
return b;
|
|
}
|
|
|
|
// CHECK:STDOUT: --- local.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %F.type: type = fn_type @F [template]
|
|
// CHECK:STDOUT: %F: %F.type = struct_value () [template]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .F = %F.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
|
|
// CHECK:STDOUT: %return.patt: %empty_tuple.type = return_slot_pattern
|
|
// CHECK:STDOUT: %return.param_patt: %empty_tuple.type = out_param_pattern %return.patt, runtime_param0
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %.loc11_12.1: %empty_tuple.type = tuple_literal ()
|
|
// CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param runtime_param0
|
|
// CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F() -> %empty_tuple.type {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.var: ref %empty_tuple.type = var a
|
|
// CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var
|
|
// CHECK:STDOUT: %.loc12_16.1: %empty_tuple.type = tuple_literal ()
|
|
// CHECK:STDOUT: %.loc12_16.2: init %empty_tuple.type = tuple_init () to %a.var [template = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc12_17: init %empty_tuple.type = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%empty_tuple]
|
|
// CHECK:STDOUT: assign %a.var, %.loc12_17
|
|
// CHECK:STDOUT: %a.ref: ref %empty_tuple.type = name_ref a, %a
|
|
// CHECK:STDOUT: %b: ref %empty_tuple.type = bind_alias b, %a
|
|
// CHECK:STDOUT: %b.ref: ref %empty_tuple.type = name_ref b, %b
|
|
// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [template = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc14: %empty_tuple.type = converted %b.ref, %tuple [template = constants.%empty_tuple]
|
|
// CHECK:STDOUT: return %.loc14
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|