// 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/where_expr/fail_not_facet.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/where_expr/fail_not_facet.carbon // --- fail_left_where_not_facet.carbon library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_left_where_not_facet.carbon:[[@LINE+4]]:10: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType] // CHECK:STDERR: fn F(T:! i32 where .Self == bool); // CHECK:STDERR: ^~~ // CHECK:STDERR: fn F(T:! i32 where .Self == bool); // --- fail_left_where_unknown.carbon library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_left_where_unknown.carbon:[[@LINE+4]]:10: error: name `NOT_DECLARED` not found [NameNotFound] // CHECK:STDERR: fn G(U:! NOT_DECLARED where .Self == bool); // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: fn G(U:! NOT_DECLARED where .Self == bool); // --- fail_var.carbon library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:8: error: name `e` not found [NameNotFound] // CHECK:STDERR: var v: e where .x = 3; // CHECK:STDERR: ^ // CHECK:STDERR: var v: e where .x = 3; // CHECK:STDOUT: --- fail_left_where_not_facet.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] // CHECK:STDOUT: %T.patt: = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .Bool = %Core.Bool // 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: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { // CHECK:STDOUT: %T.patt.loc8_6.1: = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_6.2 (constants.%T.patt)] // CHECK:STDOUT: %T.param_patt: = value_param_pattern %T.patt.loc8_6.1, runtime_param [symbolic = %T.patt.loc8_6.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.param: = value_param runtime_param // CHECK:STDOUT: %.loc8_14.1: type = splice_block %.loc8_14.2 [template = ] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %.Self: = bind_symbolic_name .Self [template = ] // CHECK:STDOUT: %.Self.ref: = name_ref .Self, %.Self [template = ] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] // CHECK:STDOUT: %.loc8_14.2: type = where_expr %.Self [template = ] { // CHECK:STDOUT: requirement_equivalent %.Self.ref, %bool.make_type // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %T: = bind_symbolic_name T, 0, %T.param [template = ] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T: ) { // CHECK:STDOUT: %T.patt.loc8_6.2: = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_6.2 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%T.param_patt: ); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F() { // CHECK:STDOUT: %T.patt.loc8_6.2 => // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_left_where_unknown.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] // CHECK:STDOUT: %U.patt: = symbolic_binding_pattern U, 0 [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Bool = %Core.Bool // 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: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { // CHECK:STDOUT: %U.patt.loc8_6.1: = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_6.2 (constants.%U.patt)] // CHECK:STDOUT: %U.param_patt: = value_param_pattern %U.patt.loc8_6.1, runtime_param [symbolic = %U.patt.loc8_6.2 (constants.%U.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %U.param: = value_param runtime_param // CHECK:STDOUT: %.loc8_23.1: type = splice_block %.loc8_23.2 [template = ] { // CHECK:STDOUT: %NOT_DECLARED.ref: = name_ref NOT_DECLARED, [template = ] // CHECK:STDOUT: %.Self: = bind_symbolic_name .Self [template = ] // CHECK:STDOUT: %.Self.ref: = name_ref .Self, %.Self [template = ] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] // CHECK:STDOUT: %.loc8_23.2: type = where_expr %.Self [template = ] { // CHECK:STDOUT: requirement_equivalent %.Self.ref, %bool.make_type // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %U: = bind_symbolic_name U, 0, %U.param [template = ] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G(%U: ) { // CHECK:STDOUT: %U.patt.loc8_6.2: = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_6.2 (constants.%U.patt)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%U.param_patt: ); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G() { // CHECK:STDOUT: %U.patt.loc8_6.2 => // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [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: .v = %v // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = binding_pattern v // CHECK:STDOUT: %.loc8_1: = var_pattern %v.patt // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.2 [template = ] { // CHECK:STDOUT: %e.ref: = name_ref e, [template = ] // CHECK:STDOUT: %.Self: = bind_symbolic_name .Self [template = ] // CHECK:STDOUT: %.Self.ref: = name_ref .Self, %.Self [template = ] // CHECK:STDOUT: %x.ref: = name_ref x, [template = ] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3] // CHECK:STDOUT: %.loc8_10.2: type = where_expr %.Self [template = ] { // CHECK:STDOUT: requirement_rewrite %x.ref, // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %v: = bind_name v, // CHECK:STDOUT: } // CHECK:STDOUT: