Files
carbon-lang/toolchain/check/testdata/class/static_method.carbon
T
Richard Smith 5665660677 Remove special-case formatting for class and interface LHS. (#3744)
These now have a type_id, so we can use the normal formatting.
2024-03-06 23:32:33 +00:00

61 lines
2.1 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
class Class {
fn F() -> i32;
}
fn Run() -> i32 {
var c: Class;
return c.F();
}
// CHECK:STDOUT: --- static_method.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Class: type = class_type @Class [template]
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %.2: type = tuple_type () [template]
// CHECK:STDOUT: %.3: type = ptr_type {} [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Class = %Class.decl
// CHECK:STDOUT: .Run = %Run
// CHECK:STDOUT: }
// CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {}
// CHECK:STDOUT: %Run: <function> = fn_decl @Run [template] {
// CHECK:STDOUT: %return.var: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @Class {
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
// CHECK:STDOUT: %return.var: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%Class
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run() -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
// CHECK:STDOUT: %c.var: ref Class = var c
// CHECK:STDOUT: %c: ref Class = bind_name c, %c.var
// CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c
// CHECK:STDOUT: %F.ref: <function> = name_ref F, @Class.%F [template = @Class.%F]
// CHECK:STDOUT: %.loc13_13.1: init i32 = call %F.ref()
// CHECK:STDOUT: %.loc13_15: i32 = value_of_initializer %.loc13_13.1
// CHECK:STDOUT: %.loc13_13.2: i32 = converted %.loc13_13.1, %.loc13_15
// CHECK:STDOUT: return %.loc13_13.2
// CHECK:STDOUT: }
// CHECK:STDOUT: