mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-25 13:02:42 +00:00
Also add `name_reference_untyped` for references to non-first-class names without types, which currently covers namespaces and functions. This improves the fidelity of the SemIR representation, and fixes some issues where we would use the wrong location for nodes and diagnostics downstream of a name reference. We're still missing a representation for dotted name expressions, such as `Namespace.Function`, and we don't use the `untyped` node as an operand of any other node yet.
55 lines
2.0 KiB
Plaintext
55 lines
2.0 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
|
|
|
|
fn F() -> bool { return true; }
|
|
fn G() -> bool { return true; }
|
|
|
|
fn Or() -> bool {
|
|
return F() or G();
|
|
}
|
|
|
|
// CHECK:STDOUT: file "or.carbon" {
|
|
// CHECK:STDOUT: %F = fn_decl @F
|
|
// CHECK:STDOUT: %G = fn_decl @G
|
|
// CHECK:STDOUT: %Or = fn_decl @Or
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F() -> bool {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %.loc7: bool = bool_literal true
|
|
// CHECK:STDOUT: return %.loc7
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @G() -> bool {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %.loc8: bool = bool_literal true
|
|
// CHECK:STDOUT: return %.loc8
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Or() -> bool {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %F.ref = name_reference_untyped "F", package.%F
|
|
// CHECK:STDOUT: %.loc11_11.1: init bool = call @F()
|
|
// CHECK:STDOUT: %.loc11_11.2: ref bool = temporary_storage
|
|
// CHECK:STDOUT: %.loc11_11.3: ref bool = temporary %.loc11_11.2, %.loc11_11.1
|
|
// CHECK:STDOUT: %.loc11_11.4: bool = bind_value %.loc11_11.3
|
|
// CHECK:STDOUT: %.loc11_14.1: bool = not %.loc11_11.4
|
|
// CHECK:STDOUT: %.loc11_14.2: bool = bool_literal true
|
|
// CHECK:STDOUT: if %.loc11_14.1 br !or.rhs else br !or.result(%.loc11_14.2)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !or.rhs:
|
|
// CHECK:STDOUT: %G.ref = name_reference_untyped "G", package.%G
|
|
// CHECK:STDOUT: %.loc11_18.1: init bool = call @G()
|
|
// CHECK:STDOUT: %.loc11_18.2: ref bool = temporary_storage
|
|
// CHECK:STDOUT: %.loc11_18.3: ref bool = temporary %.loc11_18.2, %.loc11_18.1
|
|
// CHECK:STDOUT: %.loc11_18.4: bool = bind_value %.loc11_18.3
|
|
// CHECK:STDOUT: br !or.result(%.loc11_18.4)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !or.result:
|
|
// CHECK:STDOUT: %.loc11_14.3: bool = block_arg !or.result
|
|
// CHECK:STDOUT: return %.loc11_14.3
|
|
// CHECK:STDOUT: }
|