import_final.carbon 997 B

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