fail_bad_run_2.carbon 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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/check/testdata/basics/fail_bad_run_2.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run_2.carbon
  10. // CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+4]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32` [InvalidMainRunSignature]
  11. // CHECK:STDERR: fn Run(n: i32) {}
  12. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  13. // CHECK:STDERR:
  14. fn Run(n: i32) {}
  15. // CHECK:STDOUT: --- fail_bad_run_2.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  19. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  20. // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
  21. // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: imports {
  25. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  26. // CHECK:STDOUT: .Int = %Core.Int
  27. // CHECK:STDOUT: import Core//prelude
  28. // CHECK:STDOUT: import Core//prelude/...
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: file {
  33. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  34. // CHECK:STDOUT: .Core = imports.%Core
  35. // CHECK:STDOUT: .Run = %Run.decl
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: %Core.import = import Core
  38. // CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {
  39. // CHECK:STDOUT: %n.patt: %i32 = binding_pattern n
  40. // CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, call_param0
  41. // CHECK:STDOUT: } {
  42. // CHECK:STDOUT: %n.param: %i32 = value_param call_param0
  43. // CHECK:STDOUT: %.loc15: type = splice_block %i32 [concrete = constants.%i32] {
  44. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  45. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT: %n: %i32 = bind_name n, %n.param
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: fn @Run(%n.param_patt: %i32) {
  52. // CHECK:STDOUT: !entry:
  53. // CHECK:STDOUT: return
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: