fail_bad_run_2.carbon 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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+3]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32`
  11. // CHECK:STDERR: fn Run(n: i32) {}
  12. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  13. fn Run(n: i32) {}
  14. // CHECK:STDOUT: --- fail_bad_run_2.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  18. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  19. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  20. // CHECK:STDOUT: %Run.type: type = fn_type @Run [template]
  21. // CHECK:STDOUT: %Run: %Run.type = struct_value () [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: imports {
  25. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  26. // CHECK:STDOUT: .Int32 = %import_ref
  27. // CHECK:STDOUT: import Core//prelude
  28. // CHECK:STDOUT: import Core//prelude/operators
  29. // CHECK:STDOUT: import Core//prelude/types
  30. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  31. // CHECK:STDOUT: import Core//prelude/operators/as
  32. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  33. // CHECK:STDOUT: import Core//prelude/operators/comparison
  34. // CHECK:STDOUT: import Core//prelude/types/bool
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: file {
  40. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  41. // CHECK:STDOUT: .Core = imports.%Core
  42. // CHECK:STDOUT: .Run = %Run.decl
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT: %Core.import = import Core
  45. // CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [template = constants.%Run] {
  46. // CHECK:STDOUT: %n.patt: i32 = binding_pattern n
  47. // CHECK:STDOUT: %n.param_patt: i32 = param_pattern %n.patt, runtime_param0
  48. // CHECK:STDOUT: } {
  49. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  50. // CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
  51. // CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32, %.loc14_11.1 [template = i32]
  52. // CHECK:STDOUT: %param: i32 = param runtime_param0
  53. // CHECK:STDOUT: %n: i32 = bind_name n, %param
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: }
  56. // CHECK:STDOUT:
  57. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: fn @Run(%n.param_patt: i32) {
  60. // CHECK:STDOUT: !entry:
  61. // CHECK:STDOUT: return
  62. // CHECK:STDOUT: }
  63. // CHECK:STDOUT: