fail_todo_define_default_fn_inline.carbon 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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/interface/fail_todo_define_default_fn_inline.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon
  10. interface Interface {
  11. // CHECK:STDERR: fail_todo_define_default_fn_inline.carbon:[[@LINE+4]]:3: ERROR: Semantics TODO: `interface modifier`.
  12. // CHECK:STDERR: default fn F() {}
  13. // CHECK:STDERR: ^~~~~~~
  14. // CHECK:STDERR:
  15. default fn F() {}
  16. // CHECK:STDERR: fail_todo_define_default_fn_inline.carbon:[[@LINE+3]]:3: ERROR: Semantics TODO: `interface modifier`.
  17. // CHECK:STDERR: default fn G(a: i32, b: i32) -> i32 = "int.sadd";
  18. // CHECK:STDERR: ^~~~~~~
  19. default fn G(a: i32, b: i32) -> i32 = "int.sadd";
  20. }
  21. // CHECK:STDOUT: --- fail_todo_define_default_fn_inline.carbon
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: constants {
  24. // CHECK:STDOUT: %.1: type = interface_type @Interface [template]
  25. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic]
  26. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  27. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  28. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  29. // CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, %F.type [template]
  30. // CHECK:STDOUT: %.4: %.3 = assoc_entity element0, @Interface.%F.decl [template]
  31. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  32. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  33. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  34. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  35. // CHECK:STDOUT: %.5: type = assoc_entity_type @Interface, %G.type [template]
  36. // CHECK:STDOUT: %.6: %.5 = assoc_entity element1, @Interface.%G.decl [template]
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: file {
  40. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  41. // CHECK:STDOUT: .Core = %Core
  42. // CHECK:STDOUT: .Interface = %Interface.decl
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  45. // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {}
  46. // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  47. // CHECK:STDOUT: %import_ref.2: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  48. // CHECK:STDOUT: %import_ref.3: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: interface @Interface {
  52. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic = constants.%Self]
  53. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {}
  54. // CHECK:STDOUT: %.loc16: %.3 = assoc_entity element0, %F.decl [template = constants.%.4]
  55. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  56. // CHECK:STDOUT: %int.make_type_32.loc21_19: init type = call constants.%Int32() [template = i32]
  57. // CHECK:STDOUT: %.loc21_19.1: type = value_of_initializer %int.make_type_32.loc21_19 [template = i32]
  58. // CHECK:STDOUT: %.loc21_19.2: type = converted %int.make_type_32.loc21_19, %.loc21_19.1 [template = i32]
  59. // CHECK:STDOUT: %a.loc21_16.1: i32 = param a
  60. // CHECK:STDOUT: %a.loc21_16.2: i32 = bind_name a, %a.loc21_16.1
  61. // CHECK:STDOUT: %int.make_type_32.loc21_27: init type = call constants.%Int32() [template = i32]
  62. // CHECK:STDOUT: %.loc21_27.1: type = value_of_initializer %int.make_type_32.loc21_27 [template = i32]
  63. // CHECK:STDOUT: %.loc21_27.2: type = converted %int.make_type_32.loc21_27, %.loc21_27.1 [template = i32]
  64. // CHECK:STDOUT: %b.loc21_24.1: i32 = param b
  65. // CHECK:STDOUT: %b.loc21_24.2: i32 = bind_name b, %b.loc21_24.1
  66. // CHECK:STDOUT: %int.make_type_32.loc21_35: init type = call constants.%Int32() [template = i32]
  67. // CHECK:STDOUT: %.loc21_35.1: type = value_of_initializer %int.make_type_32.loc21_35 [template = i32]
  68. // CHECK:STDOUT: %.loc21_35.2: type = converted %int.make_type_32.loc21_35, %.loc21_35.1 [template = i32]
  69. // CHECK:STDOUT: %return.var: ref i32 = var <return slot>
  70. // CHECK:STDOUT: }
  71. // CHECK:STDOUT: %.loc21_39: %.5 = assoc_entity element1, %G.decl [template = constants.%.6]
  72. // CHECK:STDOUT:
  73. // CHECK:STDOUT: !members:
  74. // CHECK:STDOUT: .Self = %Self
  75. // CHECK:STDOUT: .F = %.loc16
  76. // CHECK:STDOUT: .G = %.loc21_39
  77. // CHECK:STDOUT: witness = (%F.decl, %G.decl)
  78. // CHECK:STDOUT: }
  79. // CHECK:STDOUT:
  80. // CHECK:STDOUT: fn @F() {
  81. // CHECK:STDOUT: !entry:
  82. // CHECK:STDOUT: return
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: fn @G(@Interface.%a.loc21_16.2: i32, @Interface.%b.loc21_24.2: i32) -> i32 = "int.sadd";
  88. // CHECK:STDOUT: