basic.carbon 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/interface/basic.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/interface/basic.carbon
  10. interface I {
  11. fn Assoc();
  12. }
  13. // There are no interesting runtime operations here, but there's no rule saying
  14. // you can't pass a facet around at runtime, so make sure it works.
  15. fn F(T: I) -> I { return T; }
  16. interface J;
  17. // Declared-but-not-defined interfaces are still complete types.
  18. fn G(T: J) {}
  19. // CHECK:STDOUT: ; ModuleID = 'basic.carbon'
  20. // CHECK:STDOUT: source_filename = "basic.carbon"
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: define void @F() {
  23. // CHECK:STDOUT: entry:
  24. // CHECK:STDOUT: ret void
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: define void @G() {
  28. // CHECK:STDOUT: entry:
  29. // CHECK:STDOUT: ret void
  30. // CHECK:STDOUT: }