fail_collapse.carbon 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. // CHECK:STDERR: fail_collapse.carbon:[[@LINE+4]]:9: `const` applied repeatedly to the same type has no additional effect.
  7. // CHECK:STDERR: fn G(p: const (const i32)**) -> i32** {
  8. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  9. // CHECK:STDERR:
  10. fn G(p: const (const i32)**) -> i32** {
  11. // CHECK:STDERR: fail_collapse.carbon:[[@LINE+3]]:3: ERROR: Cannot implicitly convert from `const i32**` to `i32**`.
  12. // CHECK:STDERR: return p;
  13. // CHECK:STDERR: ^~~~~~~~~
  14. return p;
  15. }
  16. // CHECK:STDOUT: --- fail_collapse.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %.1: type = const_type i32 [template]
  20. // CHECK:STDOUT: %.2: type = ptr_type const i32 [template]
  21. // CHECK:STDOUT: %.3: type = ptr_type const i32* [template]
  22. // CHECK:STDOUT: %.4: type = ptr_type i32 [template]
  23. // CHECK:STDOUT: %.5: type = ptr_type i32* [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  28. // CHECK:STDOUT: .G = %G
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: %G: <function> = fn_decl @G [template] {
  31. // CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.1]
  32. // CHECK:STDOUT: %.loc11_9: type = const_type const i32 [template = constants.%.1]
  33. // CHECK:STDOUT: %.loc11_26: type = ptr_type const i32 [template = constants.%.2]
  34. // CHECK:STDOUT: %.loc11_27: type = ptr_type const i32* [template = constants.%.3]
  35. // CHECK:STDOUT: %p.loc11_6.1: const i32** = param p
  36. // CHECK:STDOUT: @G.%p: const i32** = bind_name p, %p.loc11_6.1
  37. // CHECK:STDOUT: %.loc11_36: type = ptr_type i32 [template = constants.%.4]
  38. // CHECK:STDOUT: %.loc11_37: type = ptr_type i32* [template = constants.%.5]
  39. // CHECK:STDOUT: %return.var: ref i32** = var <return slot>
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: fn @G(%p: const i32**) -> i32** {
  44. // CHECK:STDOUT: !entry:
  45. // CHECK:STDOUT: %p.ref: const i32** = name_ref p, %p
  46. // CHECK:STDOUT: return <error>
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT: