fail_todo_define_default_fn_inline.carbon 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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/int.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/interface/fail_todo_define_default_fn_inline.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon
  14. interface Interface {
  15. // CHECK:STDERR: fail_todo_define_default_fn_inline.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo]
  16. // CHECK:STDERR: default fn F() {}
  17. // CHECK:STDERR: ^~~~~~~
  18. // CHECK:STDERR:
  19. default fn F() {}
  20. // CHECK:STDERR: fail_todo_define_default_fn_inline.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo]
  21. // CHECK:STDERR: default fn G(a: i32, b: i32) -> i32 = "int.sadd";
  22. // CHECK:STDERR: ^~~~~~~
  23. // CHECK:STDERR:
  24. default fn G(a: i32, b: i32) -> i32 = "int.sadd";
  25. }
  26. // CHECK:STDOUT: --- fail_todo_define_default_fn_inline.carbon
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: constants {
  29. // CHECK:STDOUT: %Interface.type: type = facet_type <@Interface> [concrete]
  30. // CHECK:STDOUT: %Self: %Interface.type = symbolic_binding Self, 0 [symbolic]
  31. // CHECK:STDOUT: %Interface.F.type: type = fn_type @Interface.F [concrete]
  32. // CHECK:STDOUT: %Interface.F: %Interface.F.type = struct_value () [concrete]
  33. // CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface [concrete]
  34. // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.%Interface.F.decl [concrete]
  35. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  36. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  37. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  38. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  39. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  40. // CHECK:STDOUT: %Interface.G.type: type = fn_type @Interface.G [concrete]
  41. // CHECK:STDOUT: %Interface.G: %Interface.G.type = struct_value () [concrete]
  42. // CHECK:STDOUT: %assoc1: %Interface.assoc_type = assoc_entity element1, @Interface.%Interface.G.decl [concrete]
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: imports {
  46. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  47. // CHECK:STDOUT: .Int = %Core.Int
  48. // CHECK:STDOUT: import Core//prelude
  49. // CHECK:STDOUT: import Core//prelude/...
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: file {
  55. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  56. // CHECK:STDOUT: .Core = imports.%Core
  57. // CHECK:STDOUT: .Interface = %Interface.decl
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: %Core.import = import Core
  60. // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [concrete = constants.%Interface.type] {} {}
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: interface @Interface {
  64. // CHECK:STDOUT: %Self: %Interface.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  65. // CHECK:STDOUT: %Interface.F.decl: %Interface.F.type = fn_decl @Interface.F [concrete = constants.%Interface.F] {} {}
  66. // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %Interface.F.decl [concrete = constants.%assoc0]
  67. // CHECK:STDOUT: %Interface.G.decl: %Interface.G.type = fn_decl @Interface.G [concrete = constants.%Interface.G] {
  68. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  69. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  70. // CHECK:STDOUT: %b.patt: %pattern_type.7ce = value_binding_pattern b [concrete]
  71. // CHECK:STDOUT: %b.param_patt: %pattern_type.7ce = value_param_pattern %b.patt, call_param1 [concrete]
  72. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  73. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param2 [concrete]
  74. // CHECK:STDOUT: } {
  75. // CHECK:STDOUT: %int_32.loc26_35: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  76. // CHECK:STDOUT: %i32.loc26_35: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  77. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  78. // CHECK:STDOUT: %.loc26_19: type = splice_block %i32.loc26_19 [concrete = constants.%i32] {
  79. // CHECK:STDOUT: %int_32.loc26_19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  80. // CHECK:STDOUT: %i32.loc26_19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  81. // CHECK:STDOUT: }
  82. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  83. // CHECK:STDOUT: %b.param: %i32 = value_param call_param1
  84. // CHECK:STDOUT: %.loc26_27: type = splice_block %i32.loc26_27 [concrete = constants.%i32] {
  85. // CHECK:STDOUT: %int_32.loc26_27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  86. // CHECK:STDOUT: %i32.loc26_27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  87. // CHECK:STDOUT: }
  88. // CHECK:STDOUT: %b: %i32 = value_binding b, %b.param
  89. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2
  90. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT: %assoc1: %Interface.assoc_type = assoc_entity element1, %Interface.G.decl [concrete = constants.%assoc1]
  93. // CHECK:STDOUT:
  94. // CHECK:STDOUT: !members:
  95. // CHECK:STDOUT: .Self = %Self
  96. // CHECK:STDOUT: .F = %assoc0
  97. // CHECK:STDOUT: .G = %assoc1
  98. // CHECK:STDOUT: witness = (%Interface.F.decl, %Interface.G.decl)
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: generic fn @Interface.F(@Interface.%Self: %Interface.type) {
  102. // CHECK:STDOUT: !definition:
  103. // CHECK:STDOUT:
  104. // CHECK:STDOUT: fn() {
  105. // CHECK:STDOUT: !entry:
  106. // CHECK:STDOUT: return
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT:
  110. // CHECK:STDOUT: generic fn @Interface.G(@Interface.%Self: %Interface.type) {
  111. // CHECK:STDOUT: !definition:
  112. // CHECK:STDOUT:
  113. // CHECK:STDOUT: fn(%a.param: %i32, %b.param: %i32) -> %i32 = "int.sadd";
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT:
  116. // CHECK:STDOUT: specific @Interface.F(constants.%Self) {}
  117. // CHECK:STDOUT:
  118. // CHECK:STDOUT: specific @Interface.G(constants.%Self) {}
  119. // CHECK:STDOUT: