import_impl_with_no_interface.carbon 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/import_impl_with_no_interface.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/import_impl_with_no_interface.carbon
  12. // --- fail_lib.carbon
  13. library "[[@TEST_NAME]]";
  14. // CHECK:STDERR: fail_lib.carbon:[[@LINE+4]]:18: error: name `Undeclared` not found [NameNotFound]
  15. // CHECK:STDERR: impl {.i: ()} as Undeclared {
  16. // CHECK:STDERR: ^~~~~~~~~~
  17. // CHECK:STDERR:
  18. impl {.i: ()} as Undeclared {
  19. fn F() {}
  20. }
  21. interface Instance {
  22. fn G[self: Self]();
  23. }
  24. impl {.i: ()} as Instance {
  25. fn G[self: Self]() {}
  26. }
  27. // --- import_instance_success.carbon
  28. library "[[@TEST_NAME]]";
  29. import library "lib";
  30. fn InstanceCallImport(n: {.i: ()}) {
  31. n.(Instance.G)();
  32. }