fail_assoc_const_not_constant.carbon 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. interface I {
  7. // CHECK:STDERR: fail_assoc_const_not_constant.carbon:[[@LINE+3]]:7: ERROR: Pattern in associated constant declaration must be a single `:!` binding.
  8. // CHECK:STDERR: let a: i32;
  9. // CHECK:STDERR: ^
  10. let a: i32;
  11. }
  12. // We shouldn't issue further errors on uses of the invalid name.
  13. alias UseA = I.a;
  14. // Ideally we would still diagnose this, but it's OK that we don't.
  15. alias UseOther = I.other;
  16. // CHECK:STDOUT: --- fail_assoc_const_not_constant.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %.1: type = interface_type @I [template]
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file {
  23. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  24. // CHECK:STDOUT: .I = %I.decl
  25. // CHECK:STDOUT: .UseA = %UseA
  26. // CHECK:STDOUT: .UseOther = %UseOther
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {}
  29. // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1]
  30. // CHECK:STDOUT: %a.ref: <error> = name_ref a, <error> [template = <error>]
  31. // CHECK:STDOUT: %UseA: <error> = bind_alias UseA, <error> [template = <error>]
  32. // CHECK:STDOUT: %I.ref.loc18: type = name_ref I, %I.decl [template = constants.%.1]
  33. // CHECK:STDOUT: %other.ref: <error> = name_ref other, <error> [template = <error>]
  34. // CHECK:STDOUT: %UseOther: <error> = bind_alias UseOther, <error> [template = <error>]
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: interface @I {
  38. // CHECK:STDOUT: %Self: I = bind_symbolic_name Self [symbolic]
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: !members:
  41. // CHECK:STDOUT: .Self = %Self
  42. // CHECK:STDOUT: has_error
  43. // CHECK:STDOUT: witness = ()
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT: