Files
carbon-lang/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon
T
Jon Ross-Perkins 3561ab5fae Switch the prelude to using 'export import'. (#3976)
Note, I assume this doesn't affect all the TODOs (like for i32.carbon),
but does cut some things down (and requires updating some tests that
have prelude name conflicts, but I think they were intended to be
updated this way).
2024-05-22 22:55:31 +00:00

62 lines
2.7 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 Main() -> i32 {
// CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: ERROR: Cannot access member of interface Add in type i32 that does not implement that interface.
// CHECK:STDERR: return 12 + 34;
// CHECK:STDERR: ^~~~~~~
return 12 + 34;
}
// CHECK:STDOUT: --- fail_unimplemented_op.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Main: type = fn_type @Main [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: Main = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 12 [template]
// CHECK:STDOUT: %.3: i32 = int_literal 34 [template]
// CHECK:STDOUT: %.4: type = interface_type @Add [template]
// CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic]
// CHECK:STDOUT: %Op: type = fn_type @Op [template]
// CHECK:STDOUT: %struct.2: Op = struct_value () [template]
// CHECK:STDOUT: %.5: type = assoc_entity_type @Add, Op [template]
// CHECK:STDOUT: %.6: <associated Op in Add> = assoc_entity element0, file.%import_ref.5 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .Main = %Main.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {
// CHECK:STDOUT: @Main.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: type = import_ref ir4, inst+1, loaded [template = constants.%.4]
// CHECK:STDOUT: %import_ref.2 = import_ref ir4, inst+3, unloaded
// CHECK:STDOUT: %import_ref.3: <associated Op in Add> = import_ref ir4, inst+24, loaded [template = constants.%.6]
// CHECK:STDOUT: %import_ref.4 = import_ref ir4, inst+19, unloaded
// CHECK:STDOUT: %import_ref.5 = import_ref ir4, inst+19, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: interface @Add {
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = file.%import_ref.2
// CHECK:STDOUT: .Op = file.%import_ref.3
// CHECK:STDOUT: witness = (file.%import_ref.4)
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Main() -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc11_10: i32 = int_literal 12 [template = constants.%.2]
// CHECK:STDOUT: %.loc11_15: i32 = int_literal 34 [template = constants.%.3]
// CHECK:STDOUT: return <error>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Op[%self: Self](%other: Self) -> Self;
// CHECK:STDOUT: