fail_todo_assoc_const_default.carbon 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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`.
  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`.
  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: %.1: type = interface_type @I [template]
  25. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic]
  26. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  27. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  28. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  29. // CHECK:STDOUT: %.3: type = tuple_type (type, type) [template]
  30. // CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template]
  31. // CHECK:STDOUT: %.5: type = assoc_entity_type %.1, type [template]
  32. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, @I.%T [template]
  33. // CHECK:STDOUT: %.7: i32 = int_literal 42 [template]
  34. // CHECK:STDOUT: %.8: type = assoc_entity_type %.1, i32 [template]
  35. // CHECK:STDOUT: %.9: %.8 = assoc_entity element1, @I.%N [template]
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: imports {
  39. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  40. // CHECK:STDOUT: .Int32 = %import_ref
  41. // CHECK:STDOUT: import Core//prelude
  42. // CHECK:STDOUT: import Core//prelude/operators
  43. // CHECK:STDOUT: import Core//prelude/types
  44. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  45. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  46. // CHECK:STDOUT: import Core//prelude/operators/comparison
  47. // CHECK:STDOUT: import Core//prelude/types/bool
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: file {
  53. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  54. // CHECK:STDOUT: .Core = imports.%Core
  55. // CHECK:STDOUT: .I = %I.decl
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT: %Core.import = import Core
  58. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {}
  59. // CHECK:STDOUT: }
  60. // CHECK:STDOUT:
  61. // CHECK:STDOUT: interface @I {
  62. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic = constants.%Self]
  63. // CHECK:STDOUT: %int.make_type_32.loc16_27: init type = call constants.%Int32() [template = i32]
  64. // CHECK:STDOUT: %int.make_type_32.loc16_32: init type = call constants.%Int32() [template = i32]
  65. // CHECK:STDOUT: %.loc16_35: %.3 = tuple_literal (%int.make_type_32.loc16_27, %int.make_type_32.loc16_32)
  66. // CHECK:STDOUT: %.loc16_36.1: type = value_of_initializer %int.make_type_32.loc16_27 [template = i32]
  67. // CHECK:STDOUT: %.loc16_36.2: type = converted %int.make_type_32.loc16_27, %.loc16_36.1 [template = i32]
  68. // CHECK:STDOUT: %.loc16_36.3: type = value_of_initializer %int.make_type_32.loc16_32 [template = i32]
  69. // CHECK:STDOUT: %.loc16_36.4: type = converted %int.make_type_32.loc16_32, %.loc16_36.3 [template = i32]
  70. // CHECK:STDOUT: %.loc16_36.5: type = converted %.loc16_35, constants.%.4 [template = constants.%.4]
  71. // CHECK:STDOUT: %T: type = assoc_const_decl T [template]
  72. // CHECK:STDOUT: %.loc16_36.6: %.5 = assoc_entity element0, %T [template = constants.%.6]
  73. // CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%Int32() [template = i32]
  74. // CHECK:STDOUT: %.loc20_19.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32]
  75. // CHECK:STDOUT: %.loc20_19.2: type = converted %int.make_type_32.loc20, %.loc20_19.1 [template = i32]
  76. // CHECK:STDOUT: %.loc20_25: i32 = int_literal 42 [template = constants.%.7]
  77. // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template]
  78. // CHECK:STDOUT: %.loc20_27: %.8 = assoc_entity element1, %N [template = constants.%.9]
  79. // CHECK:STDOUT:
  80. // CHECK:STDOUT: !members:
  81. // CHECK:STDOUT: .Self = %Self
  82. // CHECK:STDOUT: .T = %.loc16_36.6
  83. // CHECK:STDOUT: .N = %.loc20_27
  84. // CHECK:STDOUT: witness = (%T, %N)
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  88. // CHECK:STDOUT: