fail_assoc_const_bad_default.carbon 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_bad_default.carbon:[[@LINE+3]]:3: ERROR: Cannot implicitly convert from `i32` to `type`.
  8. // CHECK:STDERR: let T:! type = 42;
  9. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  10. let T:! type = 42;
  11. }
  12. // CHECK:STDOUT: --- fail_assoc_const_bad_default.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %.1: type = interface_type @I [template]
  16. // CHECK:STDOUT: %.2: i32 = int_literal 42 [template]
  17. // CHECK:STDOUT: %.3: type = assoc_entity_type @I, type [template]
  18. // CHECK:STDOUT: %.4: <associated type in I> = assoc_entity element0, @I.%T [template]
  19. // CHECK:STDOUT: }
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: file {
  22. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  23. // CHECK:STDOUT: .I = %I.decl
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {}
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: interface @I {
  29. // CHECK:STDOUT: %Self: I = bind_symbolic_name Self [symbolic]
  30. // CHECK:STDOUT: %.loc11_18: i32 = int_literal 42 [template = constants.%.2]
  31. // CHECK:STDOUT: %T: type = assoc_const_decl T [template]
  32. // CHECK:STDOUT: %.loc11_20: <associated type in I> = assoc_entity element0, %T [template = constants.%.4]
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: !members:
  35. // CHECK:STDOUT: .Self = %Self
  36. // CHECK:STDOUT: .T = %.loc11_20
  37. // CHECK:STDOUT: witness = (%T)
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: