forward_decl.carbon 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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: %type: type = facet_type <type> [concrete]
  19. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self]
  20. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  21. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  22. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  23. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  28. // CHECK:STDOUT: .F = %F.decl
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  31. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  32. // CHECK:STDOUT: } {
  33. // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  34. // CHECK:STDOUT: %T.loc15_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_6.1 (constants.%T)]
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: generic fn @F(%T.loc15_6.2: type) {
  39. // CHECK:STDOUT: %T.loc15_6.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_6.1 (constants.%T)]
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn();
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: specific @F(constants.%T) {
  45. // CHECK:STDOUT: %T.loc15_6.1 => constants.%T
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT: