fail_todo_define_default_fn_inline.carbon 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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` [SemanticsTodo]
  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` [SemanticsTodo]
  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: %Interface.type: type = facet_type <@Interface> [template]
  25. // CHECK:STDOUT: %Self: %Interface.type = bind_symbolic_name Self, 0 [symbolic]
  26. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  27. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  28. // CHECK:STDOUT: %.1: type = assoc_entity_type %Interface.type, %F.type [template]
  29. // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @Interface.%F.decl [template]
  30. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 32 [template]
  31. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  32. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  33. // CHECK:STDOUT: %i32: type = int_type signed, %.3 [template]
  34. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  35. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  36. // CHECK:STDOUT: %.4: type = assoc_entity_type %Interface.type, %G.type [template]
  37. // CHECK:STDOUT: %.5: %.4 = assoc_entity element1, @Interface.%G.decl [template]
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: imports {
  41. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  42. // CHECK:STDOUT: .Int = %import_ref
  43. // CHECK:STDOUT: import Core//prelude
  44. // CHECK:STDOUT: import Core//prelude/...
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: file {
  49. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  50. // CHECK:STDOUT: .Core = imports.%Core
  51. // CHECK:STDOUT: .Interface = %Interface.decl
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT: %Core.import = import Core
  54. // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%Interface.type] {} {}
  55. // CHECK:STDOUT: }
  56. // CHECK:STDOUT:
  57. // CHECK:STDOUT: interface @Interface {
  58. // CHECK:STDOUT: %Self: %Interface.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  59. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  60. // CHECK:STDOUT: %.loc16: %.1 = assoc_entity element0, %F.decl [template = constants.%.2]
  61. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  62. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  63. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  64. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  65. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1
  66. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  67. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2
  68. // CHECK:STDOUT: } {
  69. // CHECK:STDOUT: %.loc21_19.1: Core.IntLiteral = int_value 32 [template = constants.%.3]
  70. // CHECK:STDOUT: %int.make_type_signed.loc21_19: init type = call constants.%Int(%.loc21_19.1) [template = constants.%i32]
  71. // CHECK:STDOUT: %.loc21_19.2: type = value_of_initializer %int.make_type_signed.loc21_19 [template = constants.%i32]
  72. // CHECK:STDOUT: %.loc21_19.3: type = converted %int.make_type_signed.loc21_19, %.loc21_19.2 [template = constants.%i32]
  73. // CHECK:STDOUT: %.loc21_27.1: Core.IntLiteral = int_value 32 [template = constants.%.3]
  74. // CHECK:STDOUT: %int.make_type_signed.loc21_27: init type = call constants.%Int(%.loc21_27.1) [template = constants.%i32]
  75. // CHECK:STDOUT: %.loc21_27.2: type = value_of_initializer %int.make_type_signed.loc21_27 [template = constants.%i32]
  76. // CHECK:STDOUT: %.loc21_27.3: type = converted %int.make_type_signed.loc21_27, %.loc21_27.2 [template = constants.%i32]
  77. // CHECK:STDOUT: %.loc21_35.1: Core.IntLiteral = int_value 32 [template = constants.%.3]
  78. // CHECK:STDOUT: %int.make_type_signed.loc21_35: init type = call constants.%Int(%.loc21_35.1) [template = constants.%i32]
  79. // CHECK:STDOUT: %.loc21_35.2: type = value_of_initializer %int.make_type_signed.loc21_35 [template = constants.%i32]
  80. // CHECK:STDOUT: %.loc21_35.3: type = converted %int.make_type_signed.loc21_35, %.loc21_35.2 [template = constants.%i32]
  81. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  82. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  83. // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1
  84. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  85. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2
  86. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  87. // CHECK:STDOUT: }
  88. // CHECK:STDOUT: %.loc21: %.4 = assoc_entity element1, %G.decl [template = constants.%.5]
  89. // CHECK:STDOUT:
  90. // CHECK:STDOUT: !members:
  91. // CHECK:STDOUT: .Self = %Self
  92. // CHECK:STDOUT: .F = %.loc16
  93. // CHECK:STDOUT: .G = %.loc21
  94. // CHECK:STDOUT: witness = (%F.decl, %G.decl)
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: generic fn @F(@Interface.%Self: %Interface.type) {
  98. // CHECK:STDOUT: !definition:
  99. // CHECK:STDOUT:
  100. // CHECK:STDOUT: fn() {
  101. // CHECK:STDOUT: !entry:
  102. // CHECK:STDOUT: return
  103. // CHECK:STDOUT: }
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT:
  106. // CHECK:STDOUT: generic fn @G(@Interface.%Self: %Interface.type) {
  107. // CHECK:STDOUT: !definition:
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: fn(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sadd";
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: specific @F(constants.%Self) {}
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: specific @G(constants.%Self) {}
  115. // CHECK:STDOUT: