Files
carbon-lang/toolchain/check/testdata/class/redeclaration.carbon
T
Richard Smith 29c294880d Deduplicate and canonicalize all constants. (#3611)
Rather than producing multiple constants with the same value, fold all
instances of a given constant to the same constant instruction.

A future PR will use this to replace the current type canonicalization
system.
2024-01-18 21:42:19 +00:00

42 lines
1.2 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;
class Class {
fn F();
}
fn Class.F() {}
// CHECK:STDOUT: --- redeclaration.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Class: type = class_type @Class [template]
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace package, {.Class = %Class.decl.loc7} [template]
// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, ()
// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class]
// CHECK:STDOUT: %Class.decl.loc9 = class_decl @Class, ()
// CHECK:STDOUT: %F: <function> = fn_decl @F [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @Class {
// CHECK:STDOUT: %F: <function> = fn_decl @F [template]
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: