Move impl cycle tests to min-prelude (#5108)

Use the facet_types min-prelude instead of defining a Core package in
the test file.
This commit is contained in:
Dana Jansens
2025-03-11 19:38:12 +00:00
committed by GitHub
parent 82fe19ee99
commit bdf5d17b06
@@ -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.