fail_todo_assoc_const_default.carbon 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_assoc_const_default.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_assoc_const_default.carbon
  10. interface I {
  11. // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo]
  12. // CHECK:STDERR: default let T:! type = (i32, i32);
  13. // CHECK:STDERR: ^~~~~~~
  14. // CHECK:STDERR:
  15. default let T:! type = (i32, i32);
  16. // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+3]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo]
  17. // CHECK:STDERR: default let N:! i32 = 42;
  18. // CHECK:STDERR: ^~~~~~~
  19. default let N:! i32 = 42;
  20. }
  21. // CHECK:STDOUT: --- fail_todo_assoc_const_default.carbon
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: constants {
  24. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  25. // CHECK:STDOUT: %Self.1: %I.type = bind_symbolic_name Self, 0 [symbolic]
  26. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  27. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  28. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  29. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  30. // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template]
  31. // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%i32, %i32) [template]
  32. // CHECK:STDOUT: %.2: type = assoc_entity_type %I.type, type [template]
  33. // CHECK:STDOUT: %.3: %.2 = assoc_entity element0, @I.%T [template]
  34. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 42 [template]
  35. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  36. // CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.2, @impl.1(%.1) [template]
  37. // CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [template]
  38. // CHECK:STDOUT: %.24: <witness> = interface_witness (%Convert.14) [template]
  39. // CHECK:STDOUT: %.25: <bound method> = bound_method %.4, %Convert.14 [template]
  40. // CHECK:STDOUT: %.26: <specific function> = specific_function %.25, @Convert.2(%.1) [template]
  41. // CHECK:STDOUT: %.27: %i32 = int_value 42 [template]
  42. // CHECK:STDOUT: %.28: type = assoc_entity_type %I.type, %i32 [template]
  43. // CHECK:STDOUT: %.29: %.28 = assoc_entity element1, @I.%N [template]
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: imports {
  47. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  48. // CHECK:STDOUT: .Int = %import_ref.1
  49. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  50. // CHECK:STDOUT: import Core//prelude
  51. // CHECK:STDOUT: import Core//prelude/...
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: file {
  56. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  57. // CHECK:STDOUT: .Core = imports.%Core
  58. // CHECK:STDOUT: .I = %I.decl
  59. // CHECK:STDOUT: }
  60. // CHECK:STDOUT: %Core.import = import Core
  61. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  62. // CHECK:STDOUT: }
  63. // CHECK:STDOUT:
  64. // CHECK:STDOUT: interface @I {
  65. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  66. // CHECK:STDOUT: %.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%.1]
  67. // CHECK:STDOUT: %int.make_type_signed.loc16_27: init type = call constants.%Int(%.loc16_27) [template = constants.%i32]
  68. // CHECK:STDOUT: %.loc16_32: Core.IntLiteral = int_value 32 [template = constants.%.1]
  69. // CHECK:STDOUT: %int.make_type_signed.loc16_32: init type = call constants.%Int(%.loc16_32) [template = constants.%i32]
  70. // CHECK:STDOUT: %.loc16_35: %tuple.type.1 = tuple_literal (%int.make_type_signed.loc16_27, %int.make_type_signed.loc16_32)
  71. // CHECK:STDOUT: %.loc16_36.1: type = value_of_initializer %int.make_type_signed.loc16_27 [template = constants.%i32]
  72. // CHECK:STDOUT: %.loc16_36.2: type = converted %int.make_type_signed.loc16_27, %.loc16_36.1 [template = constants.%i32]
  73. // CHECK:STDOUT: %.loc16_36.3: type = value_of_initializer %int.make_type_signed.loc16_32 [template = constants.%i32]
  74. // CHECK:STDOUT: %.loc16_36.4: type = converted %int.make_type_signed.loc16_32, %.loc16_36.3 [template = constants.%i32]
  75. // CHECK:STDOUT: %.loc16_36.5: type = converted %.loc16_35, constants.%tuple.type.2 [template = constants.%tuple.type.2]
  76. // CHECK:STDOUT: %T: type = assoc_const_decl T [template]
  77. // CHECK:STDOUT: %.loc16_36.6: %.2 = assoc_entity element0, %T [template = constants.%.3]
  78. // CHECK:STDOUT: %.loc20_19.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  79. // CHECK:STDOUT: %int.make_type_signed.loc20: init type = call constants.%Int(%.loc20_19.1) [template = constants.%i32]
  80. // CHECK:STDOUT: %.loc20_19.2: type = value_of_initializer %int.make_type_signed.loc20 [template = constants.%i32]
  81. // CHECK:STDOUT: %.loc20_19.3: type = converted %int.make_type_signed.loc20, %.loc20_19.2 [template = constants.%i32]
  82. // CHECK:STDOUT: %.loc20_25: Core.IntLiteral = int_value 42 [template = constants.%.4]
  83. // CHECK:STDOUT: %.loc20_27.1: %Convert.type.2 = interface_witness_access constants.%.24, element0 [template = constants.%Convert.14]
  84. // CHECK:STDOUT: %.loc20_27.2: <bound method> = bound_method %.loc20_25, %.loc20_27.1 [template = constants.%.25]
  85. // CHECK:STDOUT: %.loc20_27.3: <specific function> = specific_function %.loc20_27.2, @Convert.2(constants.%.1) [template = constants.%.26]
  86. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %.loc20_27.3(%.loc20_25) [template = constants.%.27]
  87. // CHECK:STDOUT: %.loc20_27.4: %i32 = value_of_initializer %int.convert_checked [template = constants.%.27]
  88. // CHECK:STDOUT: %.loc20_27.5: %i32 = converted %.loc20_25, %.loc20_27.4 [template = constants.%.27]
  89. // CHECK:STDOUT: %N: %i32 = assoc_const_decl N [template]
  90. // CHECK:STDOUT: %.loc20_27.6: %.28 = assoc_entity element1, %N [template = constants.%.29]
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: !members:
  93. // CHECK:STDOUT: .Self = %Self
  94. // CHECK:STDOUT: .T = %.loc16_36.6
  95. // CHECK:STDOUT: .N = %.loc20_27.6
  96. // CHECK:STDOUT: witness = (%T, %N)
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT: