|
|
@@ -10,6 +10,39 @@
|
|
|
// TIP: To dump output, run:
|
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/where_expr/constraints.carbon
|
|
|
|
|
|
+// --- self_impls_type.carbon
|
|
|
+
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+interface I {}
|
|
|
+
|
|
|
+//@dump-sem-ir-begin
|
|
|
+fn F(T:! I where .Self impls type);
|
|
|
+//@dump-sem-ir-end
|
|
|
+
|
|
|
+alias Type = type;
|
|
|
+
|
|
|
+//@dump-sem-ir-begin
|
|
|
+fn G(T:! I where .Self impls Type);
|
|
|
+//@dump-sem-ir-end
|
|
|
+
|
|
|
+// --- fail_self_impls_error.carbon
|
|
|
+
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+interface I {}
|
|
|
+
|
|
|
+//@dump-sem-ir-begin
|
|
|
+// Because there's an error inside the `where`, the constant value of the
|
|
|
+// `where` should be an error also.
|
|
|
+//
|
|
|
+// CHECK:STDERR: fail_self_impls_error.carbon:[[@LINE+4]]:30: error: name `J` not found [NameNotFound]
|
|
|
+// CHECK:STDERR: fn F(T:! I where .Self impls J);
|
|
|
+// CHECK:STDERR: ^
|
|
|
+// CHECK:STDERR:
|
|
|
+fn F(T:! I where .Self impls J);
|
|
|
+//@dump-sem-ir-end
|
|
|
+
|
|
|
// --- state_constraints.carbon
|
|
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
@@ -151,6 +184,115 @@ fn F() {
|
|
|
//@dump-sem-ir-end
|
|
|
}
|
|
|
|
|
|
+// CHECK:STDOUT: --- self_impls_type.carbon
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: constants {
|
|
|
+// CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
|
|
|
+// CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
|
|
|
+// CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
|
|
|
+// CHECK:STDOUT: %T: %I.type = bind_symbolic_name T, 0 [symbolic]
|
|
|
+// CHECK:STDOUT: %pattern_type: type = pattern_type %I.type [concrete]
|
|
|
+// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
|
|
+// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
|
|
|
+// CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: imports {
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: file {
|
|
|
+// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
|
|
+// CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
|
|
|
+// CHECK:STDOUT: } {
|
|
|
+// CHECK:STDOUT: %.loc7_12.1: type = splice_block %.loc7_12.2 [concrete = constants.%I.type] {
|
|
|
+// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
|
|
|
+// CHECK:STDOUT: <elided>
|
|
|
+// CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
|
|
|
+// CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
|
|
|
+// CHECK:STDOUT: %.loc7_18: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
|
|
|
+// CHECK:STDOUT: %.loc7_12.2: type = where_expr %.Self [concrete = constants.%I.type] {
|
|
|
+// CHECK:STDOUT: requirement_impls %.loc7_18, type
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %T.loc7_6.1: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc7_6.2 (constants.%T)]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
|
|
|
+// CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
|
|
|
+// CHECK:STDOUT: } {
|
|
|
+// CHECK:STDOUT: %.loc13_12.1: type = splice_block %.loc13_12.2 [concrete = constants.%I.type] {
|
|
|
+// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
|
|
|
+// CHECK:STDOUT: <elided>
|
|
|
+// CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
|
|
|
+// CHECK:STDOUT: %Type.ref: type = name_ref Type, file.%Type [concrete = type]
|
|
|
+// CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
|
|
|
+// CHECK:STDOUT: %.loc13_18: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
|
|
|
+// CHECK:STDOUT: %.loc13_12.2: type = where_expr %.Self [concrete = constants.%I.type] {
|
|
|
+// CHECK:STDOUT: requirement_impls %.loc13_18, %Type.ref
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %T.loc13_6.1: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc13_6.2 (constants.%T)]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: generic fn @F(%T.loc7_6.1: %I.type) {
|
|
|
+// CHECK:STDOUT: %T.loc7_6.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc7_6.2 (constants.%T)]
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn();
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: generic fn @G(%T.loc13_6.1: %I.type) {
|
|
|
+// CHECK:STDOUT: %T.loc13_6.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc13_6.2 (constants.%T)]
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn();
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @F(constants.%T) {
|
|
|
+// CHECK:STDOUT: %T.loc7_6.2 => constants.%T
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @G(constants.%T) {
|
|
|
+// CHECK:STDOUT: %T.loc13_6.2 => constants.%T
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: --- fail_self_impls_error.carbon
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: constants {
|
|
|
+// CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
|
|
|
+// CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
|
|
|
+// CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
|
|
|
+// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
|
|
+// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: imports {
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: file {
|
|
|
+// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
|
|
+// CHECK:STDOUT: %T.patt: <error> = symbolic_binding_pattern T, 0 [concrete]
|
|
|
+// CHECK:STDOUT: } {
|
|
|
+// CHECK:STDOUT: %.loc14_12.1: type = splice_block %.loc14_12.2 [concrete = <error>] {
|
|
|
+// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
|
|
|
+// CHECK:STDOUT: <elided>
|
|
|
+// CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
|
|
|
+// CHECK:STDOUT: %J.ref: <error> = name_ref J, <error> [concrete = <error>]
|
|
|
+// CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
|
|
|
+// CHECK:STDOUT: %.loc14_18: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
|
|
|
+// CHECK:STDOUT: %.loc14_12.2: type = where_expr %.Self [concrete = <error>] {
|
|
|
+// CHECK:STDOUT: requirement_impls %.loc14_18, <error>
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %T: <error> = bind_symbolic_name T, 0 [concrete = <error>]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: generic fn @F(%T: <error>) {
|
|
|
+// CHECK:STDOUT: fn();
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @F(<error>) {}
|
|
|
+// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: --- state_constraints.carbon
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: constants {
|