From bdf5d17b0619fb4161bfe6a6189ef8d8ab6c81bc Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 11 Mar 2025 15:38:12 -0400 Subject: [PATCH] Move impl cycle tests to min-prelude (#5108) Use the facet_types min-prelude instead of defining a Core package in the test file. --- .../min_prelude}/impl_cycle.carbon | 42 ++----------------- 1 file changed, 4 insertions(+), 38 deletions(-) rename toolchain/check/testdata/impl/{no_prelude => lookup/min_prelude}/impl_cycle.carbon (94%) diff --git a/toolchain/check/testdata/impl/no_prelude/impl_cycle.carbon b/toolchain/check/testdata/impl/lookup/min_prelude/impl_cycle.carbon similarity index 94% rename from toolchain/check/testdata/impl/no_prelude/impl_cycle.carbon rename to toolchain/check/testdata/impl/lookup/min_prelude/impl_cycle.carbon index 4e940ffa2e6f..67e745761d96 100644 --- a/toolchain/check/testdata/impl/no_prelude/impl_cycle.carbon +++ b/toolchain/check/testdata/impl/lookup/min_prelude/impl_cycle.carbon @@ -2,38 +2,18 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// EXTRA-ARGS: --no-dump-sem-ir +// INCLUDE-FILE: toolchain/testing/min_prelude/facet_types.carbon +// EXTRA-ARGS: --no-dump-sem-ir --custom-core // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/impl_cycle.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/min_prelude/impl_cycle.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/impl_cycle.carbon - -// --- core.carbon -package Core; - -interface As(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -interface BitAnd { - fn Op[self: Self](other: Self) -> Self; -} - -impl forall [T:! type] T as BitAnd { - fn Op[self: Self](other: Self) -> Self = "type.and"; -} +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/min_prelude/impl_cycle.carbon // --- fail_impl_simple_cycle.carbon library "[[@TEST_NAME]]"; -import Core; - interface Z {} // This creates a dependency cycle with itself. @@ -57,8 +37,6 @@ fn F() { // --- todo_fail_impl_simple_where_cycle.carbon library "[[@TEST_NAME]]"; -import Core; - interface Z {} // This creates a dependency cycle with itself. @@ -76,8 +54,6 @@ fn F() { // --- fail_impl_simple_two_interfaces.carbon library "[[@TEST_NAME]]"; -import Core; - interface Z {} interface Y {} @@ -103,8 +79,6 @@ fn F() { // --- fail_impl_long_cycle.carbon library "[[@TEST_NAME]]"; -import Core; - interface X {} interface Y {} interface Z {} @@ -137,8 +111,6 @@ fn F() { // --- fail_impl_cycle_one_generic_param.carbon library "[[@TEST_NAME]]"; -import Core; - interface ComparableWith(T:! type) {} // This creates a dependency cycle with itself. @@ -208,8 +180,6 @@ fn F() { // --- impl_recurse_with_simpler_type_no_cycle.carbon library "[[@TEST_NAME]]"; -import Core; - class Wraps(T:! type) {} interface Printable {} @@ -228,8 +198,6 @@ fn F() { // --- impl_recurse_with_simpler_type_in_generic_param_no_cycle.carbon library "[[@TEST_NAME]]"; -import Core; - class Wraps(T:! type) {} interface ComparableTo(T:! type) {} @@ -253,8 +221,6 @@ fn F() { // --- impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon library "[[@TEST_NAME]]"; -import Core; - // Implement this for a type in one direction. interface ComparableTo(T:! type) {} // Use this as a bound with two types in any direction.