import_final.carbon 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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/min_prelude/facet_types.carbon
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=only
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/min_prelude/import_final.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/min_prelude/import_final.carbon
  13. // --- interface_z.carbon
  14. library "[[@TEST_NAME]]";
  15. interface Z {
  16. let X:! type;
  17. }
  18. class C {}
  19. final impl forall [T:! type] T as Z where .X = C {}
  20. // --- import_final.carbon
  21. library "[[@TEST_NAME]]";
  22. import library "interface_z";
  23. fn F[U:! type](T:! Z) {
  24. // The value of `.X` can be known to be `C` here when the impl `T as Z(C)` is
  25. // final.
  26. let a: T.X = {} as C;
  27. }