mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 13:21:05 +01:00
The none.carbon min-prelude is not just an empty prelude, it also prevents any prelude from being imported at all. So no import machinery runs before the test, only the `package` statement from the prelude would run. Use the none.carbon min-prelude in a few tests that were specifying `--no-prelude-import` to give it a trial run. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
58 lines
1.9 KiB
Plaintext
58 lines
1.9 KiB
Plaintext
// 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
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/name_poisoning.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/name_poisoning.carbon
|
|
|
|
// --- using_poisoned_name_in_impl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
interface I {};
|
|
|
|
namespace N;
|
|
// Use `package.I` and poison `N.I`.
|
|
fn N.F1(x:! I);
|
|
|
|
class N.C {
|
|
extend impl as I {
|
|
}
|
|
}
|
|
|
|
// --- fail_impl_function_poisoned.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
interface I {
|
|
fn A(x: Self);
|
|
fn B();
|
|
}
|
|
|
|
class B {
|
|
impl as I {
|
|
// CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+3]]:13: error: name `B` used before it was declared [NameUseBeforeDecl]
|
|
// CHECK:STDERR: fn A(x: B);
|
|
// CHECK:STDERR: ^
|
|
fn A(x: B);
|
|
// TODO: Avoid ImplMissingFunction for functions that were declared after they were poisoned.
|
|
// CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+11]]:8: note: declared here [NameUseBeforeDeclNote]
|
|
// CHECK:STDERR: fn B();
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE-10]]:3: error: missing implementation of B in impl of interface I [ImplMissingFunction]
|
|
// CHECK:STDERR: impl as I {
|
|
// CHECK:STDERR: ^~~~~~~~~~~
|
|
// CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE-17]]:3: note: associated function B declared here [AssociatedFunctionHere]
|
|
// CHECK:STDERR: fn B();
|
|
// CHECK:STDERR: ^~~~~~~
|
|
// CHECK:STDERR:
|
|
fn B();
|
|
}
|
|
}
|