| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- // 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/if/no_else.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if/no_else.carbon
- fn F() {}
- fn G() {}
- fn If(b: bool) {
- if (b) {
- F();
- }
- G();
- }
- // CHECK:STDOUT: --- no_else.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
- // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
- // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
- // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [concrete]
- // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [concrete]
- // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete]
- // CHECK:STDOUT: %If.type: type = fn_type @If [concrete]
- // CHECK:STDOUT: %If: %If.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
- // CHECK:STDOUT: .Bool = %Core.Bool
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/types/bool, Bool, loaded [concrete = constants.%Bool]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: .If = %If.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
- // CHECK:STDOUT: %If.decl: %If.type = fn_decl @If [concrete = constants.%If] {
- // CHECK:STDOUT: %b.patt: %pattern_type.831 = binding_pattern b [concrete]
- // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern %b.patt, call_param0 [concrete]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %b.param: bool = value_param call_param0
- // CHECK:STDOUT: %.loc14_10.1: type = splice_block %.loc14_10.3 [concrete = bool] {
- // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [concrete = bool]
- // CHECK:STDOUT: %.loc14_10.2: type = value_of_initializer %bool.make_type [concrete = bool]
- // CHECK:STDOUT: %.loc14_10.3: type = converted %bool.make_type, %.loc14_10.2 [concrete = bool]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: bool = bind_name b, %b.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @If(%b.param: bool) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %b.ref: bool = name_ref b, %b
- // CHECK:STDOUT: if %b.ref br !if.then else br !if.else
- // CHECK:STDOUT:
- // CHECK:STDOUT: !if.then:
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
- // CHECK:STDOUT: br !if.else
- // CHECK:STDOUT:
- // CHECK:STDOUT: !if.else:
- // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
- // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|