// 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/var/fail_storage_is_literal.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_storage_is_literal.carbon fn Main() { // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+7]]:10: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var x: 1 = 1; // CHECK:STDERR: ^ // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+4]]:10: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var x: 1 = 1; // CHECK:STDERR: ^ // CHECK:STDERR: var x: 1 = 1; } // CHECK:STDOUT: --- fail_storage_is_literal.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs // 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: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: = binding_pattern x // CHECK:STDOUT: %.loc19_3: = var_pattern %x.patt // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %int_1.loc19_14: Core.IntLiteral = int_value 1 [template = constants.%int_1] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: %.1: = splice_block [template = ] { // CHECK:STDOUT: %int_1.loc19_10: Core.IntLiteral = int_value 1 [template = constants.%int_1] // CHECK:STDOUT: %.loc19_10: type = converted %int_1.loc19_10, [template = ] // CHECK:STDOUT: } // CHECK:STDOUT: %x: = bind_name x, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: