forward_decl.carbon 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/forward_decl.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/forward_decl.carbon
  14. fn F(T:! type);
  15. // CHECK:STDOUT: --- forward_decl.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  19. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  20. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  21. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  26. // CHECK:STDOUT: .F = %F.decl
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  29. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  30. // CHECK:STDOUT: } {
  31. // CHECK:STDOUT: %T.loc15_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_6.1 (constants.%T)]
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: generic fn @F(%T.loc15_6.2: type) {
  36. // CHECK:STDOUT: %T.loc15_6.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_6.1 (constants.%T)]
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: fn();
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: specific @F(constants.%T) {
  42. // CHECK:STDOUT: %T.loc15_6.1 => constants.%T
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT: