// 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/class/fail_convert_to_invalid.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_convert_to_invalid.carbon class C { // CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+4]]:10: error: name `NoSuchType` not found [NameNotFound] // CHECK:STDERR: var a: NoSuchType; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: var a: NoSuchType; } fn Make() -> C { return {.a = 123}; } // CHECK:STDOUT: --- fail_convert_to_invalid.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] // CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [template] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .Make = %Make.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} // CHECK:STDOUT: %Make.decl: %Make.type = fn_decl @Make [template = constants.%Make] { // CHECK:STDOUT: %return.patt: %C = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0 // CHECK:STDOUT: %return: ref %C = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %.loc16_8: = field_decl a, element0 [template] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %.loc16_3: = var_pattern %.loc16_8 // CHECK:STDOUT: } // CHECK:STDOUT: %.var: ref = var // CHECK:STDOUT: %complete_type: = complete_type_witness [template = ] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .a = %.loc16_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return.param_patt: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [template = constants.%int_123] // CHECK:STDOUT: %.loc20: %struct_type.a = struct_literal (%int_123) // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: