fail_todo_assoc_const_default.carbon 5.5 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` [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: %int_32: Core.IntLiteral = int_value 32 [template]
  27. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  28. // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template]
  29. // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%i32, %i32) [template]
  30. // CHECK:STDOUT: %assoc_type.1: type = assoc_entity_type %I.type, type [template]
  31. // CHECK:STDOUT: %assoc0.1: %assoc_type.1 = assoc_entity element0, @I.%T [template]
  32. // CHECK:STDOUT: %int_42.1: Core.IntLiteral = int_value 42 [template]
  33. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  34. // CHECK:STDOUT: %impl_witness.19: <witness> = impl_witness (imports.%import_ref.14), @impl.1(%int_32) [template]
  35. // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  36. // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template]
  37. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_42.1, %Convert.10 [template]
  38. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(%int_32) [template]
  39. // CHECK:STDOUT: %int_42.2: %i32 = int_value 42 [template]
  40. // CHECK:STDOUT: %assoc_type.2: type = assoc_entity_type %I.type, %i32 [template]
  41. // CHECK:STDOUT: %assoc1: %assoc_type.2 = assoc_entity element1, @I.%N [template]
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: imports {
  45. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  46. // CHECK:STDOUT: .Int = %import_ref.1
  47. // CHECK:STDOUT: .ImplicitAs = %import_ref.5
  48. // CHECK:STDOUT: import Core//prelude
  49. // CHECK:STDOUT: import Core//prelude/...
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: file {
  54. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  55. // CHECK:STDOUT: .Core = imports.%Core
  56. // CHECK:STDOUT: .I = %I.decl
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT: %Core.import = import Core
  59. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  60. // CHECK:STDOUT: }
  61. // CHECK:STDOUT:
  62. // CHECK:STDOUT: interface @I {
  63. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  64. // CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  65. // CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  66. // CHECK:STDOUT: %int_32.loc16_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  67. // CHECK:STDOUT: %i32.loc16_32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  68. // CHECK:STDOUT: %.loc16_35: %tuple.type.1 = tuple_literal (%i32.loc16_27, %i32.loc16_32)
  69. // CHECK:STDOUT: %.loc16_36: type = converted %.loc16_35, constants.%tuple.type.2 [template = constants.%tuple.type.2]
  70. // CHECK:STDOUT: %T: type = assoc_const_decl T [template]
  71. // CHECK:STDOUT: %assoc0: %assoc_type.1 = assoc_entity element0, %T [template = constants.%assoc0.1]
  72. // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [template = constants.%int_42.1]
  73. // CHECK:STDOUT: %impl.elem0: %Convert.type.2 = impl_witness_access constants.%impl_witness.19, element0 [template = constants.%Convert.10]
  74. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_42, %impl.elem0 [template = constants.%Convert.bound]
  75. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn]
  76. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_42) [template = constants.%int_42.2]
  77. // CHECK:STDOUT: %.loc20_27.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_42.2]
  78. // CHECK:STDOUT: %.loc20_27.2: %i32 = converted %int_42, %.loc20_27.1 [template = constants.%int_42.2]
  79. // CHECK:STDOUT: %N: %i32 = assoc_const_decl N [template]
  80. // CHECK:STDOUT: %assoc1: %assoc_type.2 = assoc_entity element1, %N [template = constants.%assoc1]
  81. // CHECK:STDOUT:
  82. // CHECK:STDOUT: !members:
  83. // CHECK:STDOUT: .Self = %Self
  84. // CHECK:STDOUT: .T = %assoc0
  85. // CHECK:STDOUT: .N = %assoc1
  86. // CHECK:STDOUT: witness = (%T, %N)
  87. // CHECK:STDOUT: }
  88. // CHECK:STDOUT: