fail_assoc_const_not_constant.carbon 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: .Core = %Core
  25. // CHECK:STDOUT: .I = %I.decl
  26. // CHECK:STDOUT: .UseA = %UseA
  27. // CHECK:STDOUT: .UseOther = %UseOther
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  30. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {}
  31. // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1]
  32. // CHECK:STDOUT: %a.ref: <error> = name_ref a, <error> [template = <error>]
  33. // CHECK:STDOUT: %UseA: <error> = bind_alias UseA, <error> [template = <error>]
  34. // CHECK:STDOUT: %I.ref.loc18: type = name_ref I, %I.decl [template = constants.%.1]
  35. // CHECK:STDOUT: %other.ref: <error> = name_ref other, <error> [template = <error>]
  36. // CHECK:STDOUT: %UseOther: <error> = bind_alias UseOther, <error> [template = <error>]
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: interface @I {
  40. // CHECK:STDOUT: %Self: I = bind_symbolic_name Self [symbolic]
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: !members:
  43. // CHECK:STDOUT: .Self = %Self
  44. // CHECK:STDOUT: has_error
  45. // CHECK:STDOUT: witness = ()
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT: